Richard Smith | eab9d6f | 2012-07-23 05:45:25 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic %s |
Richard Smith | 0706df4 | 2011-10-19 21:33:05 +0000 | [diff] [blame] | 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 | } |
Richard Smith | 7796eb5 | 2012-03-12 08:56:40 +0000 | [diff] [blame] | 9 | |
| 10 | struct S {}; |
Richard Smith | eab9d6f | 2012-07-23 05:45:25 +0000 | [diff] [blame] | 11 | enum E { e, }; |
Richard Smith | 7796eb5 | 2012-03-12 08:56:40 +0000 | [diff] [blame] | 12 | |
| 13 | auto f() -> struct S { |
| 14 | return S(); |
| 15 | } |
| 16 | auto g() -> enum E { |
| 17 | return E(); |
| 18 | } |
Richard Smith | eab9d6f | 2012-07-23 05:45:25 +0000 | [diff] [blame] | 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-warning {{extra ';' after member function definition}} |
| 27 | }; |
Richard Smith | 42926a0 | 2012-07-24 20:24:58 +0000 | [diff] [blame] | 28 | |
Aaron Ballman | c828620 | 2012-08-28 20:55:40 +0000 | [diff] [blame] | 29 | // This is technically okay, but not likely what the user expects, so we will |
| 30 | // pedantically warn on it |
| 31 | int *const const p = 0; // expected-warning {{duplicate 'const' declaration specifier}} |
Richard Smith | 42926a0 | 2012-07-24 20:24:58 +0000 | [diff] [blame] | 32 | const const int *q = 0; // expected-warning {{duplicate 'const' declaration specifier}} |
Richard Smith | 3686c71 | 2012-09-13 19:12:50 +0000 | [diff] [blame^] | 33 | |
| 34 | static_assert(something, ""); // expected-error {{undeclared identifier}} |