summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/cxx98-compat.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-02-25 10:20:59 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-02-25 10:20:59 +0000
commitd390de9c6312684c5e5b333f434199e193c7467a (patch)
tree27ddd3f722c9e3dde613b88e423fd1c7454fc81f /test/SemaCXX/cxx98-compat.cpp
parent2c8aee454dac03e4918f0bb6e7fb849953056aba (diff)
Fix r151443 to only apply C++11's exception for non-static data member access
in cases where we would otherwise disallow the access, and add a -Wc++98-compat diagnostic for this C++11 feature. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/cxx98-compat.cpp')
-rw-r--r--test/SemaCXX/cxx98-compat.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx98-compat.cpp b/test/SemaCXX/cxx98-compat.cpp
index 879c72211d..12b95765e0 100644
--- a/test/SemaCXX/cxx98-compat.cpp
+++ b/test/SemaCXX/cxx98-compat.cpp
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wc++98-compat -verify %s
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s
+namespace std { struct type_info; }
+
template<typename ...T> // expected-warning {{variadic templates are incompatible with C++98}}
class Variadic1 {};
@@ -268,3 +270,12 @@ Later: // expected-note {{possible target of indirect goto}}
return;
}
}
+
+namespace UnevaluatedMemberAccess {
+ struct S {
+ int n;
+ int f() { return sizeof(S::n); } // ok
+ };
+ int k = sizeof(S::n); // expected-warning {{use of non-static data member 'n' in an unevaluated context is incompatible with C++98}}
+ const std::type_info &ti = typeid(S::n); // expected-warning {{use of non-static data member 'n' in an unevaluated context is incompatible with C++98}}
+}