blob: 1676623ef65b87dbdca03b248373e08d5f30893a [file] [log] [blame]
Richard Smith69730c12012-03-12 07:56:15 +00001// RUN: %clang_cc1 -verify %s -std=c++11 -fcxx-exceptions
2
3// Tests for parsing of type-specifier-seq
4
5struct S {
6 operator constexpr int(); // expected-error{{type name does not allow constexpr}}
7};
8enum E { e };
9
10void 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 Hines651f13c2014-04-23 16:59:28 -070018 (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 Smith69730c12012-03-12 07:56:15 +000020}
Richard Smitha971d242012-05-09 20:55:26 +000021
22// And for trailing-type-specifier-seq
23
Richard Smith54655be2012-06-12 01:51:59 +000024auto f() -> unknown; // expected-error{{unknown type name 'unknown'}}