Richard Smith | 69730c1 | 2012-03-12 07:56:15 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify %s -std=c++11 -fcxx-exceptions |
| 2 | |
| 3 | // Tests for parsing of type-specifier-seq |
| 4 | |
| 5 | struct S { |
| 6 | operator constexpr int(); // expected-error{{type name does not allow constexpr}} |
| 7 | }; |
| 8 | enum E { e }; |
| 9 | |
| 10 | void f() { |
| 11 | try { |
| 12 | (void) new constexpr int; // expected-error{{type name does not allow constexpr}} |
| 13 | } catch (constexpr int) { // expected-error{{type name does not allow constexpr}} |
| 14 | } |
| 15 | |
| 16 | // These parse as type definitions, not as type references with braced |
| 17 | // initializers. Sad but true... |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 18 | (void) new struct S {}; // expected-error{{'S' cannot be defined in a type specifier}} |
| 19 | (void) new enum E { e }; // expected-error{{'E' cannot be defined in a type specifier}} |
Richard Smith | 69730c1 | 2012-03-12 07:56:15 +0000 | [diff] [blame] | 20 | } |
Richard Smith | a971d24 | 2012-05-09 20:55:26 +0000 | [diff] [blame] | 21 | |
| 22 | // And for trailing-type-specifier-seq |
| 23 | |
Richard Smith | 54655be | 2012-06-12 01:51:59 +0000 | [diff] [blame] | 24 | auto f() -> unknown; // expected-error{{unknown type name 'unknown'}} |