blob: b584f89ff447ad48adc7caf2425f4180c9d25831 [file] [log] [blame]
Argyrios Kyrtzidis33aee392010-08-16 17:27:08 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Charles Li1a88adb2016-04-14 23:47:07 +00002// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
Argyrios Kyrtzidis33aee392010-08-16 17:27:08 +00004
5struct S {
Charles Li1a88adb2016-04-14 23:47:07 +00006 S();
7#if __cplusplus <= 199711L
8 // expected-note@-2 {{because type 'S' has a user-provided default constructor}}
9#endif
Argyrios Kyrtzidis33aee392010-08-16 17:27:08 +000010};
11
David Blaikie0a8e8992011-10-19 22:43:29 +000012struct { // expected-error {{anonymous structs and classes must be class members}}
13};
14
Argyrios Kyrtzidis33aee392010-08-16 17:27:08 +000015struct E {
16 struct {
Charles Li1a88adb2016-04-14 23:47:07 +000017 S x;
18#if __cplusplus <= 199711L
19 // expected-error@-2 {{anonymous struct member 'x' has a non-trivial constructor}}
20#endif
Argyrios Kyrtzidis33aee392010-08-16 17:27:08 +000021 };
David Blaikie0a8e8992011-10-19 22:43:29 +000022 static struct {
23 };
Argyrios Kyrtzidis33aee392010-08-16 17:27:08 +000024};
John McCall2575d882014-01-30 01:12:53 +000025
26template <class T> void foo(T);
Charles Li1a88adb2016-04-14 23:47:07 +000027typedef struct { // expected-note {{use a tag name here to establish linkage prior to definition}}
28#if __cplusplus <= 199711L
29// expected-note@-2 {{declared here}}
30#endif
31
John McCall2575d882014-01-30 01:12:53 +000032 void test() {
Charles Li1a88adb2016-04-14 23:47:07 +000033 foo(this);
34#if __cplusplus <= 199711L
35 // expected-warning@-2 {{template argument uses unnamed type}}
36#endif
John McCall2575d882014-01-30 01:12:53 +000037 }
38} A; // expected-error {{unsupported: typedef changes linkage of anonymous type, but linkage was already computed}}