summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/include/clang/Sema/SemaInternal.h6
-rw-r--r--clang/test/CXX/drs/dr0xx.cpp7
-rw-r--r--clang/test/SemaCXX/undefined-internal.cpp11
3 files changed, 9 insertions, 15 deletions
diff --git a/clang/include/clang/Sema/SemaInternal.h b/clang/include/clang/Sema/SemaInternal.h
index 4ee10478e48..59c84517a7d 100644
--- a/clang/include/clang/Sema/SemaInternal.h
+++ b/clang/include/clang/Sema/SemaInternal.h
@@ -58,10 +58,8 @@ inline void MarkVarDeclODRUsed(VarDecl *Var,
SourceLocation Loc, Sema &SemaRef,
const unsigned *const FunctionScopeIndexToStopAt) {
// Keep track of used but undefined variables.
- // FIXME: We shouldn't suppress this warning for static data members.
- if (Var->hasDefinition(SemaRef.Context) == VarDecl::DeclarationOnly &&
- !Var->isExternallyVisible() &&
- !(Var->isStaticDataMember() && Var->hasInit())) {
+ if (Var->hasDefinition(SemaRef.Context) != VarDecl::Definition &&
+ !Var->isExternallyVisible()) {
SourceLocation &old = SemaRef.UndefinedButUsed[Var->getCanonicalDecl()];
if (old.isInvalid()) old = Loc;
}
diff --git a/clang/test/CXX/drs/dr0xx.cpp b/clang/test/CXX/drs/dr0xx.cpp
index 29e1720b1bb..64b85a81d99 100644
--- a/clang/test/CXX/drs/dr0xx.cpp
+++ b/clang/test/CXX/drs/dr0xx.cpp
@@ -507,14 +507,13 @@ namespace dr48 { // dr48: yes
namespace {
struct S {
static const int m = 0;
- static const int n = 0;
+ // FIXME: This diagnostic is working but gets suppressed due to other errors in the TU.
+ static const int n = 0; // FIXME-expected-warning {{has internal linkage but is not defined}}
static const int o = 0;
};
}
int a = S::m;
- // FIXME: We should produce a 'has internal linkage but is not defined'
- // diagnostic for 'S::n'.
- const int &b = S::n;
+ const int &b = S::n; // FIXME-expected-note {{used here}}
const int S::o;
const int &c = S::o;
}
diff --git a/clang/test/SemaCXX/undefined-internal.cpp b/clang/test/SemaCXX/undefined-internal.cpp
index 1cb0708a532..7f81ac9feba 100644
--- a/clang/test/SemaCXX/undefined-internal.cpp
+++ b/clang/test/SemaCXX/undefined-internal.cpp
@@ -137,15 +137,12 @@ namespace cxx11_odr_rules {
//
// Note that the warning in question can trigger in cases some people would
// consider false positives; hopefully that happens rarely in practice.
- //
- // FIXME: Suppressing this test while I figure out how to fix a bug in the
- // odr-use marking code.
namespace {
struct A {
static const int unused = 10;
- static const int used1 = 20; // xpected-warning {{internal linkage}}
- static const int used2 = 20; // xpected-warning {{internal linkage}}
+ static const int used1 = 20; // expected-warning {{internal linkage}}
+ static const int used2 = 20; // expected-warning {{internal linkage}}
virtual ~A() {}
};
}
@@ -166,10 +163,10 @@ namespace cxx11_odr_rules {
// Check that the checks work with unevaluated contexts
(void)sizeof(p(A::used1));
- (void)typeid(p(A::used1)); // xpected-note {{used here}}
+ (void)typeid(p(A::used1)); // expected-note {{used here}}
// Misc other testing
- a(A::unused, 1 ? A::used2 : A::used2); // xpected-note {{used here}}
+ a(A::unused, 1 ? A::used2 : A::used2); // expected-note {{used here}}
b();
}
}
OpenPOWER on IntegriCloud