diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /test/SemaTemplate/typename-specifier.cpp | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'test/SemaTemplate/typename-specifier.cpp')
-rw-r--r-- | test/SemaTemplate/typename-specifier.cpp | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/test/SemaTemplate/typename-specifier.cpp b/test/SemaTemplate/typename-specifier.cpp index 602e9030..b36a103 100644 --- a/test/SemaTemplate/typename-specifier.cpp +++ b/test/SemaTemplate/typename-specifier.cpp @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unused // RUN: %clang_cc1 -fsyntax-only -verify %s -Wno-unused -fms-compatibility -DMSVC +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wno-unused +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s -Wno-unused -fms-compatibility -DMSVC +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s -Wno-unused -fms-compatibility -DMSVC namespace N { struct A { typedef int type; @@ -16,22 +20,38 @@ namespace N { int i; -typename N::A::type *ip1 = &i; // expected-warning{{'typename' occurs outside of a template}} -typename N::B::type *ip2 = &i; // expected-error{{no type named 'type' in 'N::B'}} \ -// expected-warning{{'typename' occurs outside of a template}} -typename N::C::type *ip3 = &i; // expected-error{{typename specifier refers to non-type member 'type'}} \ -// expected-warning{{'typename' occurs outside of a template}} +typename N::A::type *ip1 = &i; +#if __cplusplus <= 199711L // C++03 or earlier modes +// expected-warning@-2 {{'typename' occurs outside of a template}} +#endif +typename N::B::type *ip2 = &i; // expected-error{{no type named 'type' in 'N::B'}} +#if __cplusplus <= 199711L +// expected-warning@-2 {{'typename' occurs outside of a template}} +#endif +typename N::C::type *ip3 = &i; // expected-error{{typename specifier refers to non-type member 'type'}} +#if __cplusplus <= 199711L +// expected-warning@-2 {{'typename' occurs outside of a template}} +#endif void test(double d) { - typename N::A::type f(typename N::A::type(a)); // expected-warning{{disambiguated as a function declaration}} \ - // expected-note{{add a pair of parentheses}} expected-warning 2{{'typename' occurs outside of a template}} + typename N::A::type f(typename N::A::type(a)); // expected-warning{{disambiguated as a function declaration}} + // expected-note@-1 {{add a pair of parentheses}} +#if __cplusplus <= 199711L + // expected-warning@-3 2{{'typename' occurs outside of a template}} +#endif int five = f(5); using namespace N; - for (typename A::type i = 0; i < 10; ++i) // expected-warning{{'typename' occurs outside of a template}} + for (typename A::type i = 0; i < 10; ++i) +#if __cplusplus <= 199711L +// expected-warning@-2 {{'typename' occurs outside of a template}} +#endif five += 1; - const typename N::A::type f2(d); // expected-warning{{'typename' occurs outside of a template}} + const typename N::A::type f2(d); +#if __cplusplus <= 199711L +// expected-warning@-2 {{'typename' occurs outside of a template}} +#endif } namespace N { |