]>
git.proxmox.com Git - rustc.git/blob - src/llvm/tools/clang/test/Parser/cxx-decl.cpp
1 // RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux -pedantic %s
3 const char const *x10
; // expected-warning {{duplicate 'const' declaration specifier}}
5 int x(*g
); // expected-error {{use of undeclared identifier 'g'}}
13 typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}}
15 // PR4451 - We should recover well from the typo of '::' as ':' in a2.
22 y
:a a2
; // expected-error {{unexpected ':' in nested name specifier}}
41 return 1 ? P
->x
: P
->y
;
45 class asm_class_test
{
46 void foo() __asm__("baz");
49 enum { fooenum
= 1, }; // expected-warning {{commas at the end of enumerator lists are a C++11 extension}}
55 void test(struct Type
*P
) {
57 Type
= 1 ? P
->Type
: Type
;
59 Type
= (y
:b
) 4; // expected-error {{unexpected ':' in nested name specifier}}
61 (y
:b
) // expected-error {{unexpected ':' in nested name specifier}}
66 int x
// expected-error {{expected ';' at end of declaration list}}
68 int z
// expected-error {{expected ';' at end of declaration list}}
71 // Make sure we know these are legitimate commas and not typos for ';'.
80 __attribute__(()) global2
,
84 &&global8
= static_cast<int&&>(global1
), // expected-warning 2{{rvalue reference}}
88 global11
== 0, // expected-error {{did you mean '='}}
89 global12
__attribute__(()),
96 b
__asm__("ebx"), // expected-error {{expected ';' at end of declaration}}
103 ::new(static_cast<void*>(0)) test5
; // expected-error {{expected unqualified-id}}
113 typedef Class1
<Class2
> Type1
; // expected-error {{cannot combine with previous 'class' declaration specifier}}
116 struct CodeCompleteConsumer
{
119 void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
125 void f(sqrgl
); // expected-error {{unknown type name 'sqrgl'}}
128 extern "" // expected-error {{unknown linkage language}}
129 test6a
{ ;// expected-error {{C++ requires a type specifier for all declarations}} \
130 // expected-error {{expected ';' after top level declarator}}