2012-10-18 07:31:46 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fsyntax-only -std=c++11 -pedantic-errors %s
|
2011-10-20 05:33:05 +08:00
|
|
|
|
|
|
|
// Make sure we know these are legitimate commas and not typos for ';'.
|
|
|
|
namespace Commas {
|
|
|
|
int a,
|
|
|
|
b [[ ]],
|
|
|
|
c alignas(double);
|
|
|
|
}
|
2012-03-12 16:56:40 +08:00
|
|
|
|
|
|
|
struct S {};
|
2012-07-23 13:45:25 +08:00
|
|
|
enum E { e, };
|
2012-03-12 16:56:40 +08:00
|
|
|
|
|
|
|
auto f() -> struct S {
|
|
|
|
return S();
|
|
|
|
}
|
|
|
|
auto g() -> enum E {
|
|
|
|
return E();
|
|
|
|
}
|
2012-07-23 13:45:25 +08:00
|
|
|
|
|
|
|
class ExtraSemiAfterMemFn {
|
|
|
|
// Due to a peculiarity in the C++11 grammar, a deleted or defaulted function
|
|
|
|
// is permitted to be followed by either one or two semicolons.
|
|
|
|
void f() = delete // expected-error {{expected ';' after delete}}
|
|
|
|
void g() = delete; // ok
|
|
|
|
void h() = delete;; // ok
|
2012-10-18 07:31:46 +08:00
|
|
|
void i() = delete;;; // expected-error {{extra ';' after member function definition}}
|
2012-07-23 13:45:25 +08:00
|
|
|
};
|
2012-07-25 04:24:58 +08:00
|
|
|
|
2012-10-18 07:31:46 +08:00
|
|
|
int *const const p = 0; // expected-error {{duplicate 'const' declaration specifier}}
|
|
|
|
const const int *q = 0; // expected-error {{duplicate 'const' declaration specifier}}
|
|
|
|
|
|
|
|
struct MultiCV {
|
|
|
|
void f() const const; // expected-error {{duplicate 'const' declaration specifier}}
|
|
|
|
};
|
2012-09-14 03:12:50 +08:00
|
|
|
|
|
|
|
static_assert(something, ""); // expected-error {{undeclared identifier}}
|
2012-11-16 06:54:20 +08:00
|
|
|
|
|
|
|
// PR9903
|
|
|
|
struct SS {
|
|
|
|
typedef void d() = default; // expected-error {{function definition declared 'typedef'}} expected-error {{only special member functions may be defaulted}}
|
|
|
|
};
|