1 // RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic-errors %s
2 
3 // Make sure we know these are legitimate commas and not typos for ';'.
4 namespace Commas {
5   int a,
6   b [[ ]],
7   c alignas(double);
8 }
9 
10 struct S {};
11 enum E { e, };
12 
13 auto f() -> struct S {
14   return S();
15 }
16 auto g() -> enum E {
17   return E();
18 }
19 
20 class ExtraSemiAfterMemFn {
21   // Due to a peculiarity in the C++11 grammar, a deleted or defaulted function
22   // is permitted to be followed by either one or two semicolons.
23   void f() = delete // expected-error {{expected ';' after delete}}
24   void g() = delete; // ok
25   void h() = delete;; // ok
26   void i() = delete;;; // expected-error {{extra ';' after member function definition}}
27 };
28 
29 int *const const p = 0; // expected-error {{duplicate 'const' declaration specifier}}
30 const const int *q = 0; // expected-error {{duplicate 'const' declaration specifier}}
31 
32 struct MultiCV {
33   void f() const const; // expected-error {{duplicate 'const' declaration specifier}}
34 };
35 
36 static_assert(something, ""); // expected-error {{undeclared identifier}}
37 
38 // PR9903
39 struct SS {
40   typedef void d() = default; // expected-error {{function definition declared 'typedef'}} expected-error {{only special member functions may be defaulted}}
41 };
42 
43 using PR14855 = int S::; // expected-error {{expected ';' after alias declaration}}
44 
45 // Ensure that 'this' has a const-qualified type in a trailing return type for
46 // a constexpr function.
47 struct ConstexprTrailingReturn {
48   int n;
49   constexpr auto f() -> decltype((n));
50 };
51 constexpr const int &ConstexprTrailingReturn::f() const { return n; }
52 
53 namespace TestIsValidAfterTypeSpecifier {
54 struct s {} v;
55 
56 // FIXME: We should accept this once we support thread_local.
57 struct s
58 thread_local tl; // expected-error {{expected unqualified-id}}
59 
60 struct s
61 &r0 = v;
62 
63 struct s
64 &&r1 = s();
65 
66 struct s
67 bitand r2 = v;
68 
69 struct s
70 and r3 = s();
71 
72 enum E {};
73 enum E
74 [[]] e;
75 
76 }
77