diff options
-rw-r--r-- | lib/Sema/Sema.cpp | 3 | ||||
-rw-r--r-- | test/SemaCXX/undefined-internal.cpp | 18 |
2 files changed, 21 insertions, 0 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 4b82069a62..0c5e8db1aa 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -394,6 +394,9 @@ static void checkUndefinedInternals(Sema &S) { // Ignore attributes that have become invalid. if (decl->isInvalidDecl()) continue; + // If we found out that the decl is external, don't warn. + if (decl->getLinkage() == ExternalLinkage) continue; + // __attribute__((weakref)) is basically a definition. if (decl->hasAttr<WeakRefAttr>()) continue; diff --git a/test/SemaCXX/undefined-internal.cpp b/test/SemaCXX/undefined-internal.cpp index 154172001e..e8ee4c1e90 100644 --- a/test/SemaCXX/undefined-internal.cpp +++ b/test/SemaCXX/undefined-internal.cpp @@ -181,3 +181,21 @@ namespace OverloadUse { template<void x(int)> void t(long*) { x(10); } // expected-note {{used here}} void g() { long a; t<f>(&a); } } + +namespace test7 { + typedef struct { + void bar(); + void foo() { + bar(); + } + } A; +} + +namespace test8 { + typedef struct { + void bar(); // expected-warning {{function 'test8::<anonymous struct>::bar' has internal linkage but is not defined}} + void foo() { + bar(); // expected-note {{used here}} + } + } *A; +} |