freebsd-dev/test/Parser/cxx-decl.cpp

86 lines
1.5 KiB
C++
Raw Normal View History

2010-01-01 10:34:51 +00:00
// RUN: %clang_cc1 -verify -fsyntax-only %s
2009-06-02 17:58:47 +00:00
int x(*g); // expected-error {{use of undeclared identifier 'g'}}
2009-12-15 18:49:47 +00:00
struct Type {
int Type;
};
// PR4451 - We should recover well from the typo of '::' as ':' in a2.
namespace y {
struct a { };
typedef int b;
}
y::a a1;
y:a a2; // expected-error {{unexpected ':' in nested name specifier}}
y::a a3 = a2;
// Some valid colons:
void foo() {
y: // label
y::a s;
int a = 4;
a = a ? a : a+1;
}
struct b : y::a {};
template <typename T>
class someclass {
int bar() {
T *P;
return 1 ? P->x : P->y;
}
};
2010-07-13 17:21:42 +00:00
class asm_class_test {
void foo() __asm__("baz");
};
2009-12-15 18:49:47 +00:00
enum { fooenum = 1 };
struct a {
int Type : fooenum;
};
void test(struct Type *P) {
int Type;
Type = 1 ? P->Type : Type;
Type = (y:b) 4; // expected-error {{unexpected ':' in nested name specifier}}
Type = 1 ? (
(y:b) // expected-error {{unexpected ':' in nested name specifier}}
4) : 5;
2010-01-01 10:34:51 +00:00
}
2010-02-16 09:31:36 +00:00
struct test4 {
int x // expected-error {{expected ';' at end of declaration list}}
int y;
int z // expected-error {{expected ';' at end of declaration list}}
};
2010-03-03 17:28:16 +00:00
// PR5825
struct test5 {};
::new(static_cast<void*>(0)) test5; // expected-error {{expected unqualified-id}}
2010-04-06 15:53:59 +00:00
// PR6782
template<class T>
class Class1;
class Class2 {
} // no ;
typedef Class1<Class2> Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}}
// rdar : // 8307865
struct CodeCompleteConsumer {
};
void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}}
}