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}}
|
|
|
|
};
|
2013-01-09 06:43:49 +08:00
|
|
|
|
|
|
|
using PR14855 = int S::; // expected-error {{expected ';' after alias declaration}}
|
2013-01-14 09:55:13 +08:00
|
|
|
|
|
|
|
// Ensure that 'this' has a const-qualified type in a trailing return type for
|
|
|
|
// a constexpr function.
|
|
|
|
struct ConstexprTrailingReturn {
|
|
|
|
int n;
|
|
|
|
constexpr auto f() -> decltype((n));
|
|
|
|
};
|
|
|
|
constexpr const int &ConstexprTrailingReturn::f() const { return n; }
|
2013-01-19 11:48:05 +08:00
|
|
|
|
|
|
|
namespace TestIsValidAfterTypeSpecifier {
|
|
|
|
struct s {} v;
|
|
|
|
|
|
|
|
// FIXME: We should accept this once we support thread_local.
|
|
|
|
struct s
|
|
|
|
thread_local tl; // expected-error {{expected unqualified-id}}
|
|
|
|
|
|
|
|
struct s
|
|
|
|
&r0 = v;
|
|
|
|
|
|
|
|
struct s
|
|
|
|
&&r1 = s();
|
|
|
|
|
|
|
|
struct s
|
|
|
|
bitand r2 = v;
|
|
|
|
|
|
|
|
struct s
|
|
|
|
and r3 = s();
|
|
|
|
|
|
|
|
enum E {};
|
|
|
|
enum E
|
|
|
|
[[]] e;
|
|
|
|
|
|
|
|
}
|