forked from OSchip/llvm-project
Don't look into incomplete types when trying to warn about unused
variables. Fixes PR6948. llvm-svn: 102436
This commit is contained in:
parent
a9f7c3263e
commit
19defcd6f5
|
@ -543,6 +543,11 @@ static bool ShouldDiagnoseUnusedDecl(const NamedDecl *D) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// If we failed to complete the type for some reason, don't
|
||||
// diagnose the variable.
|
||||
if (Ty->isIncompleteType())
|
||||
return false;
|
||||
|
||||
if (const TagType *TT = Ty->getAs<TagType>()) {
|
||||
const TagDecl *Tag = TT->getDecl();
|
||||
if (Tag->hasAttr<UnusedAttr>())
|
||||
|
|
|
@ -51,3 +51,11 @@ void test_dependent_init(T *p) {
|
|||
X0<int> i(p);
|
||||
(void)i;
|
||||
}
|
||||
|
||||
namespace PR6948 {
|
||||
template<typename T> class X;
|
||||
|
||||
void f() {
|
||||
X<char> str (read_from_file()); // expected-error{{use of undeclared identifier 'read_from_file'}}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue