David Tweed | d8bb236 | 2012-10-25 13:56:30 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -std=c++11 %s |
Richard Smith | b8caac8 | 2012-04-11 20:59:20 +0000 | [diff] [blame] | 2 | |
| 3 | 8gi///===--- recovery.cpp ---===// // expected-error {{unqualified-id}} |
| 4 | namespace Std { // expected-note {{here}} |
| 5 | typedef int Important; |
| 6 | } |
| 7 | |
| 8 | / redeclare as an inline namespace // expected-error {{unqualified-id}} |
| 9 | inline namespace Std { // expected-error {{cannot be reopened as inline}} |
| 10 | Important n; |
| 11 | } / end namespace Std // expected-error {{unqualified-id}} |
| 12 | int x; |
| 13 | Std::Important y; |
| 14 | |
Richard Smith | f9b1510 | 2013-08-17 00:46:16 +0000 | [diff] [blame] | 15 | extenr "C" { // expected-error {{did you mean 'extern'}} |
Richard Smith | b8caac8 | 2012-04-11 20:59:20 +0000 | [diff] [blame] | 16 | void f(); |
| 17 | } |
| 18 | void g() { |
| 19 | z = 1; // expected-error {{undeclared}} |
Kaelyn Uhrain | b5b17fe | 2012-06-15 23:45:58 +0000 | [diff] [blame] | 20 | f(); |
Richard Smith | b8caac8 | 2012-04-11 20:59:20 +0000 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | struct S { |
| 24 | int a, b, c; |
| 25 | S(); |
Richard Smith | d16fe12 | 2012-10-25 00:00:53 +0000 | [diff] [blame] | 26 | int x // expected-error {{expected ';'}} |
| 27 | friend void f() |
Richard Smith | b8caac8 | 2012-04-11 20:59:20 +0000 | [diff] [blame] | 28 | }; |
| 29 | 8S::S() : a{ 5 }, b{ 6 }, c{ 2 } { // expected-error {{unqualified-id}} |
| 30 | return; |
| 31 | } |
| 32 | int k; |
Richard Smith | d16fe12 | 2012-10-25 00:00:53 +0000 | [diff] [blame] | 33 | int l = k // expected-error {{expected ';'}} |
| 34 | constexpr int foo(); |
Richard Smith | b8caac8 | 2012-04-11 20:59:20 +0000 | [diff] [blame] | 35 | |
| 36 | 5int m = { l }, n = m; // expected-error {{unqualified-id}} |
| 37 | |
Richard Smith | da35e96 | 2013-11-09 04:52:51 +0000 | [diff] [blame] | 38 | namespace MissingBrace { |
| 39 | struct S { // expected-error {{missing '}' at end of definition of 'MissingBrace::S'}} |
| 40 | int f(); |
| 41 | // }; |
| 42 | |
| 43 | namespace N { int g(); } // expected-note {{still within definition of 'MissingBrace::S' here}} |
| 44 | |
| 45 | int k1 = S().h(); // expected-error {{no member named 'h' in 'MissingBrace::S'}} |
| 46 | int k2 = S().f() + N::g(); |
Richard Smith | 2ac43ad | 2013-11-15 23:00:02 +0000 | [diff] [blame^] | 47 | |
| 48 | template<typename T> struct PR17949 { // expected-error {{missing '}' at end of definition of 'MissingBrace::PR17949'}} |
| 49 | |
| 50 | namespace X { // expected-note {{still within definition of 'MissingBrace::PR17949' here}} |
| 51 | } |
Richard Smith | da35e96 | 2013-11-09 04:52:51 +0000 | [diff] [blame] | 52 | } |
| 53 | |
Richard Smith | b8caac8 | 2012-04-11 20:59:20 +0000 | [diff] [blame] | 54 | namespace N { |
| 55 | int |
| 56 | } // expected-error {{unqualified-id}} |
| 57 | |
Richard Smith | f9b1510 | 2013-08-17 00:46:16 +0000 | [diff] [blame] | 58 | strcut Uuuu { // expected-error {{did you mean 'struct'}} \ |
Kaelyn Uhrain | b5b17fe | 2012-06-15 23:45:58 +0000 | [diff] [blame] | 59 | // expected-note {{'Uuuu' declared here}} |
| 60 | } *u[3]; |
| 61 | uuuu v; // expected-error {{did you mean 'Uuuu'}} |
Richard Smith | 3e28469 | 2012-12-05 11:34:06 +0000 | [diff] [blame] | 62 | |
| 63 | struct Redefined { // expected-note {{previous}} |
| 64 | Redefined() {} |
| 65 | }; |
| 66 | struct Redefined { // expected-error {{redefinition}} |
| 67 | Redefined() {} |
| 68 | }; |