2011-10-14 06:29:44 +08:00
|
|
|
// RUN: %clang_cc1 -verify -std=c++11 %s
|
2010-04-24 09:30:46 +08:00
|
|
|
// RUN: cp %s %t
|
2011-10-14 06:29:44 +08:00
|
|
|
// RUN: not %clang_cc1 -x c++ -std=c++11 -fixit %t
|
|
|
|
// RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++11 %t
|
2009-11-23 21:46:08 +08:00
|
|
|
|
|
|
|
/* This is a test of the various code modification hints that only
|
|
|
|
apply in C++0x. */
|
2010-04-24 09:30:46 +08:00
|
|
|
struct A {
|
2009-11-23 21:46:08 +08:00
|
|
|
explicit operator int(); // expected-note{{conversion to integral type}}
|
|
|
|
};
|
|
|
|
|
2010-04-24 09:30:46 +08:00
|
|
|
void x() {
|
2009-11-23 21:46:08 +08:00
|
|
|
switch(A()) { // expected-error{{explicit conversion to}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-15 22:24:37 +08:00
|
|
|
using ::T = void; // expected-error {{name defined in alias declaration must be an identifier}}
|
|
|
|
using typename U = void; // expected-error {{name defined in alias declaration must be an identifier}}
|
|
|
|
using typename ::V = void; // expected-error {{name defined in alias declaration must be an identifier}}
|
2011-09-30 03:11:37 +08:00
|
|
|
|
2011-10-20 05:33:05 +08:00
|
|
|
namespace SemiCommaTypo {
|
|
|
|
int m {},
|
|
|
|
n [[]], // expected-error {{expected ';' at end of declaration}}
|
|
|
|
int o;
|
2012-01-10 06:31:44 +08:00
|
|
|
|
|
|
|
struct Base {
|
|
|
|
virtual void f2(), f3();
|
|
|
|
};
|
|
|
|
struct MemberDeclarator : Base {
|
|
|
|
int k : 4,
|
|
|
|
//[[]] : 1, FIXME: test this once we support attributes here
|
|
|
|
: 9, // expected-error {{expected ';' at end of declaration}}
|
|
|
|
char c, // expected-error {{expected ';' at end of declaration}}
|
|
|
|
typedef void F(), // expected-error {{expected ';' at end of declaration}}
|
|
|
|
F f1,
|
|
|
|
f2 final,
|
|
|
|
f3 override, // expected-error {{expected ';' at end of declaration}}
|
|
|
|
};
|
2011-10-20 05:33:05 +08:00
|
|
|
}
|
2012-01-10 09:33:14 +08:00
|
|
|
|
|
|
|
namespace ScopedEnum {
|
|
|
|
enum class E { a };
|
|
|
|
|
|
|
|
enum class E b = E::a; // expected-error {{must use 'enum' not 'enum class'}}
|
|
|
|
struct S {
|
|
|
|
friend enum class E; // expected-error {{must use 'enum' not 'enum class'}}
|
|
|
|
};
|
|
|
|
}
|