blob: d74b337b313a942939214fad655d6f3b097a7928 [file] [log] [blame]
Richard Smith87e79512012-10-17 23:31:46 +00001// RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic-errors %s
Richard Smith09f76ee2011-10-19 21:33:05 +00002
3// Make sure we know these are legitimate commas and not typos for ';'.
4namespace Commas {
5 int a,
6 b [[ ]],
7 c alignas(double);
8}
Richard Smithbfdb1082012-03-12 08:56:40 +00009
10struct S {};
Richard Smith87f5dc52012-07-23 05:45:25 +000011enum E { e, };
Richard Smithbfdb1082012-03-12 08:56:40 +000012
13auto f() -> struct S {
14 return S();
15}
16auto g() -> enum E {
17 return E();
18}
Richard Smith87f5dc52012-07-23 05:45:25 +000019
20class 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
Richard Smith87e79512012-10-17 23:31:46 +000026 void i() = delete;;; // expected-error {{extra ';' after member function definition}}
Richard Smith87f5dc52012-07-23 05:45:25 +000027};
Richard Smith7ac3c6a2012-07-24 20:24:58 +000028
Richard Smith87e79512012-10-17 23:31:46 +000029int *const const p = 0; // expected-error {{duplicate 'const' declaration specifier}}
30const const int *q = 0; // expected-error {{duplicate 'const' declaration specifier}}
31
32struct MultiCV {
33 void f() const const; // expected-error {{duplicate 'const' declaration specifier}}
34};
Richard Smith76965712012-09-13 19:12:50 +000035
36static_assert(something, ""); // expected-error {{undeclared identifier}}
Richard Smith2603b092012-11-15 22:54:20 +000037
38// PR9903
39struct SS {
40 typedef void d() = default; // expected-error {{function definition declared 'typedef'}} expected-error {{only special member functions may be defaulted}}
41};
Richard Smith5f044ad2013-01-08 22:43:49 +000042
43using PR14855 = int S::; // expected-error {{expected ';' after alias declaration}}