blob: 9895c1f53c2481086b30ed27dbb13d99a4cafbb6 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -verify -std=c++11 %s
Nick Lewyckyba5f6ec2010-04-24 01:30:46 +00002// RUN: cp %s %t
Richard Smith762bb9d2011-10-13 22:29:44 +00003// RUN: not %clang_cc1 -x c++ -std=c++11 -fixit %t
4// RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++11 %t
Douglas Gregor84fb9c02009-11-23 13:46:08 +00005
6/* This is a test of the various code modification hints that only
7 apply in C++0x. */
Nick Lewyckyba5f6ec2010-04-24 01:30:46 +00008struct A {
Douglas Gregor84fb9c02009-11-23 13:46:08 +00009 explicit operator int(); // expected-note{{conversion to integral type}}
10};
11
Nick Lewyckyba5f6ec2010-04-24 01:30:46 +000012void x() {
Douglas Gregor84fb9c02009-11-23 13:46:08 +000013 switch(A()) { // expected-error{{explicit conversion to}}
14 }
15}
16
Richard Smith162e1c12011-04-15 14:24:37 +000017using ::T = void; // expected-error {{name defined in alias declaration must be an identifier}}
18using typename U = void; // expected-error {{name defined in alias declaration must be an identifier}}
19using typename ::V = void; // expected-error {{name defined in alias declaration must be an identifier}}
Richard Smithc6d990a2011-09-29 19:11:37 +000020
Richard Smith0706df42011-10-19 21:33:05 +000021namespace SemiCommaTypo {
22 int m {},
23 n [[]], // expected-error {{expected ';' at end of declaration}}
24 int o;
Richard Smith1c94c162012-01-09 22:31:44 +000025
26 struct Base {
27 virtual void f2(), f3();
28 };
29 struct MemberDeclarator : Base {
30 int k : 4,
31 //[[]] : 1, FIXME: test this once we support attributes here
32 : 9, // expected-error {{expected ';' at end of declaration}}
33 char c, // expected-error {{expected ';' at end of declaration}}
34 typedef void F(), // expected-error {{expected ';' at end of declaration}}
35 F f1,
36 f2 final,
37 f3 override, // expected-error {{expected ';' at end of declaration}}
38 };
Richard Smith0706df42011-10-19 21:33:05 +000039}