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
|
|
|
|
|
|
|
namespace Constexpr {
|
|
|
|
extern constexpr int a; // expected-error {{must be a definition}}
|
|
|
|
// -> extern const int a;
|
|
|
|
|
|
|
|
extern constexpr int *b; // expected-error {{must be a definition}}
|
|
|
|
// -> extern int *const b;
|
|
|
|
|
|
|
|
extern constexpr int &c; // expected-error {{must be a definition}}
|
|
|
|
// -> extern int &b;
|
|
|
|
|
|
|
|
extern constexpr const int d; // expected-error {{must be a definition}}
|
|
|
|
// -> extern const int d;
|
|
|
|
|
|
|
|
int z;
|
|
|
|
constexpr int a = 0;
|
|
|
|
constexpr int *b = &z;
|
|
|
|
constexpr int &c = z;
|
|
|
|
constexpr int d = a;
|
|
|
|
|
|
|
|
// FIXME: Provide FixIts for static data members too.
|
|
|
|
#if 0
|
|
|
|
struct S {
|
|
|
|
static constexpr int b; // xpected-error {{requires an initializer}}
|
|
|
|
// -> const int b;
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr int S::b = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct S {
|
2011-09-30 07:18:34 +08:00
|
|
|
static char *const p = 0; // expected-error {{requires 'constexpr' specifier}}
|
2011-09-30 03:11:37 +08:00
|
|
|
// -> constexpr static char *const p = 0;
|
|
|
|
};
|
|
|
|
}
|