From 1a88adbb27a21e7728253c2f932b41009e314985 Mon Sep 17 00:00:00 2001 From: Charles Li Date: Thu, 14 Apr 2016 23:47:07 +0000 Subject: Lit C++11 Compatibility Patch #8 24 tests have been updated for C++11 compatibility. llvm-svn: 266387 --- clang/test/SemaCXX/anonymous-struct.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'clang/test/SemaCXX/anonymous-struct.cpp') diff --git a/clang/test/SemaCXX/anonymous-struct.cpp b/clang/test/SemaCXX/anonymous-struct.cpp index 1b5dc13cea0..b584f89ff44 100644 --- a/clang/test/SemaCXX/anonymous-struct.cpp +++ b/clang/test/SemaCXX/anonymous-struct.cpp @@ -1,7 +1,12 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct S { - S(); // expected-note {{because type 'S' has a user-provided default constructor}} + S(); +#if __cplusplus <= 199711L + // expected-note@-2 {{because type 'S' has a user-provided default constructor}} +#endif }; struct { // expected-error {{anonymous structs and classes must be class members}} @@ -9,15 +14,25 @@ struct { // expected-error {{anonymous structs and classes must be class members struct E { struct { - S x; // expected-error {{anonymous struct member 'x' has a non-trivial constructor}} + S x; +#if __cplusplus <= 199711L + // expected-error@-2 {{anonymous struct member 'x' has a non-trivial constructor}} +#endif }; static struct { }; }; template void foo(T); -typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}} expected-note {{declared here}} +typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}} +#if __cplusplus <= 199711L +// expected-note@-2 {{declared here}} +#endif + void test() { - foo(this); // expected-warning {{template argument uses unnamed type}} + foo(this); +#if __cplusplus <= 199711L + // expected-warning@-2 {{template argument uses unnamed type}} +#endif } } A; // expected-error {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}} -- cgit v1.2.3