aboutsummaryrefslogtreecommitdiff
path: root/test/Parser/cxx11-type-specifier.cpp
blob: 1676623ef65b87dbdca03b248373e08d5f30893a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// RUN: %clang_cc1 -verify %s -std=c++11 -fcxx-exceptions

// Tests for parsing of type-specifier-seq

struct S {
  operator constexpr int(); // expected-error{{type name does not allow constexpr}}
};
enum E { e };

void f() {
  try {
    (void) new constexpr int; // expected-error{{type name does not allow constexpr}}
  } catch (constexpr int) { // expected-error{{type name does not allow constexpr}}
  }

  // These parse as type definitions, not as type references with braced
  // initializers. Sad but true...
  (void) new struct S {}; // expected-error{{'S' cannot be defined in a type specifier}}
  (void) new enum E { e }; // expected-error{{'E' cannot be defined in a type specifier}}
}

// And for trailing-type-specifier-seq

auto f() -> unknown; // expected-error{{unknown type name 'unknown'}}