diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-01 11:08:04 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-12-01 11:08:04 +0000 |
commit | 1569ce68681d909594d64f9b056d71f5dd7563bf (patch) | |
tree | 867cbbe32a66fd7d62dd9ce9df23a23fefdb8290 /test/Parser | |
parent | f5bd02d290ff15268853e0456c130a1afa15e907 (diff) | |
download | src-1569ce68681d909594d64f9b056d71f5dd7563bf.tar.gz src-1569ce68681d909594d64f9b056d71f5dd7563bf.zip |
Notes
Diffstat (limited to 'test/Parser')
-rw-r--r-- | test/Parser/MicrosoftExtensions.c | 2 | ||||
-rw-r--r-- | test/Parser/attributes.c | 1 | ||||
-rw-r--r-- | test/Parser/cxx-attributes.cpp | 9 | ||||
-rw-r--r-- | test/Parser/cxx-parse-member-pointer-op.cpp | 13 | ||||
-rw-r--r-- | test/Parser/cxx-template-decl.cpp | 4 | ||||
-rw-r--r-- | test/Parser/cxx-using-declaration.cpp | 5 | ||||
-rw-r--r-- | test/Parser/cxx0x-attributes.cpp | 61 | ||||
-rw-r--r-- | test/Parser/cxx0x-literal-operators.cpp | 5 | ||||
-rw-r--r-- | test/Parser/if-scope-c90.c | 2 | ||||
-rw-r--r-- | test/Parser/if-scope-c99.c | 2 |
10 files changed, 83 insertions, 21 deletions
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c index 572ac44d1f40..9c804c354e5a 100644 --- a/test/Parser/MicrosoftExtensions.c +++ b/test/Parser/MicrosoftExtensions.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify -fms-extensions -x=objective-c++ %s +// RUN: clang-cc -fsyntax-only -verify -fms-extensions -x objective-c++ %s __stdcall int func0(); int __stdcall func(); typedef int (__cdecl *tptr)(); diff --git a/test/Parser/attributes.c b/test/Parser/attributes.c index dc2bb02670c6..cad39d382d18 100644 --- a/test/Parser/attributes.c +++ b/test/Parser/attributes.c @@ -51,3 +51,4 @@ int foo42(void) { // rdar://6096491 void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void); +void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn)); diff --git a/test/Parser/cxx-attributes.cpp b/test/Parser/cxx-attributes.cpp new file mode 100644 index 000000000000..743d9b9ec1f2 --- /dev/null +++ b/test/Parser/cxx-attributes.cpp @@ -0,0 +1,9 @@ +// RUN: clang-cc -fsyntax-only -verify %s
+
+class c {
+ virtual void f1(const char* a, ...)
+ __attribute__ (( __format__(__printf__,2,3) )) = 0;
+ virtual void f2(const char* a, ...)
+ __attribute__ (( __format__(__printf__,2,3) )) {}
+};
+
diff --git a/test/Parser/cxx-parse-member-pointer-op.cpp b/test/Parser/cxx-parse-member-pointer-op.cpp deleted file mode 100644 index cc2e8b142fcb..000000000000 --- a/test/Parser/cxx-parse-member-pointer-op.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// RUN: clang-cc -fsyntax-only -pedantic -verify %s - -struct C {}; - -typedef void (C::*pmfc)(); - -void g(pmfc) { - C *c; - c->*pmfc(); // expected-error {{invalid use of pointer to member type after '->*'}} - C c1; - c1.*pmfc(); // expected-error {{invalid use of pointer to member type after '.*'}} -} - diff --git a/test/Parser/cxx-template-decl.cpp b/test/Parser/cxx-template-decl.cpp index 2b2d3de50497..644f0def79c9 100644 --- a/test/Parser/cxx-template-decl.cpp +++ b/test/Parser/cxx-template-decl.cpp @@ -1,11 +1,11 @@ -// RUN: clang-cc -fsyntax-only -verify -fms-extensions=0 %s +// RUN: clang-cc -fsyntax-only -verify %s // Errors export class foo { }; // expected-error {{expected template}} template x; // expected-error {{C++ requires a type specifier for all declarations}} \ // expected-error {{does not refer}} export template x; // expected-error {{expected '<' after 'template'}} -export template<class T> class x0; // expected-note {{exported templates are unsupported}} +export template<class T> class x0; // expected-warning {{exported templates are unsupported}} template < ; // expected-error {{parse error}} expected-error {{declaration does not declare anything}} template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \ // expected-error{{extraneous}} diff --git a/test/Parser/cxx-using-declaration.cpp b/test/Parser/cxx-using-declaration.cpp index a2bc8c54edc7..461b9e597d25 100644 --- a/test/Parser/cxx-using-declaration.cpp +++ b/test/Parser/cxx-using-declaration.cpp @@ -1,4 +1,3 @@ -// FIXME: Disabled, appears to have undefined behavior, and needs to be updated to match new warnings. // RUN: clang-cc -fsyntax-only -verify %s // XFAIL: * @@ -12,7 +11,7 @@ using A::VA; using A::FA; using typename A::SA; -void main() +int main() { VA = 1; FA(); @@ -35,7 +34,7 @@ namespace E { template <typename TYPE> int funcE(TYPE arg) { return(arg); } } -using E::funcE<int>; // expected-error{{use of template specialization in using directive not allowed}} +using E::funcE<int>; // expected-error{{using declaration can not refer to a template specialization}} namespace F { struct X; diff --git a/test/Parser/cxx0x-attributes.cpp b/test/Parser/cxx0x-attributes.cpp new file mode 100644 index 000000000000..a66e3e059766 --- /dev/null +++ b/test/Parser/cxx0x-attributes.cpp @@ -0,0 +1,61 @@ +// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s + +// Declaration syntax checks +[[]] int before_attr; +int after_attr [[]]; +int * [[]] ptr_attr; +int array_attr [1] [[]]; +[[align(8)]] int aligned_attr; +[[test::valid(for 42 [very] **** '+' symbols went on a trip; the end.)]] + int garbage_attr; +void fn_attr () [[]]; +class [[]] class_attr {}; +extern "C++" [[]] int extern_attr; +template <typename T> [[]] void template_attr (); + +int comma_attr [[,]]; // expected-error {{expected identifier}} +int scope_attr [[foo::]]; // expected-error {{expected identifier}} +int & [[]] ref_attr = after_attr; // expected-error {{an attribute list cannot appear here}} +class foo { + void after_const_attr () const [[]]; // expected-error {{expected expression}} +}; +extern "C++" [[]] { } // expected-error {{an attribute list cannot appear here}} +[[]] template <typename T> void before_template_attr (); // expected-error {{an attribute list cannot appear here}} +[[]] namespace ns { int i; } // expected-error {{an attribute list cannot appear here}} +[[]] static_assert(true, ""); //expected-error {{an attribute list cannot appear here}} +[[]] asm(""); // expected-error {{an attribute list cannot appear here}} + +[[]] using ns::i; // expected-error {{an attribute list cannot appear here}} +[[]] using namespace ns; + +// Argument tests +[[final()]] int final_params; // expected-error {{C++0x attribute 'final' cannot have an argument list}} +[[align]] int aligned_no_params; // expected-error {{C++0x attribute 'align' must have an argument list}} +[[align(i)]] int aligned_nonconst; // expected-error {{'aligned' attribute requires integer constant}} + +// Statement tests +void foo () { + [[]] ; + [[]] { } + [[]] if (0) { } + [[]] for (;;); + [[]] do { + [[]] continue; + } while (0); + [[]] while (0); + + [[]] switch (i) { + [[]] case 0: + [[]] default: + [[]] break; + } + + [[]] goto there; + [[]] there: + + [[]] try { + } [[]] catch (...) { // expected-error {{an attribute list cannot appear here}} + } + + [[]] return; +} diff --git a/test/Parser/cxx0x-literal-operators.cpp b/test/Parser/cxx0x-literal-operators.cpp new file mode 100644 index 000000000000..c5514601d116 --- /dev/null +++ b/test/Parser/cxx0x-literal-operators.cpp @@ -0,0 +1,5 @@ +// RUN: clang-cc -fsyntax-only -verify -std=c++0x %s + +void operator "" (); // expected-error {{expected identifier}} +void operator "k" foo(); // expected-error {{string literal after 'operator' must be '""'}} +void operator "" tester (int); diff --git a/test/Parser/if-scope-c90.c b/test/Parser/if-scope-c90.c index 53987dccbc37..c372f0fc4f4d 100644 --- a/test/Parser/if-scope-c90.c +++ b/test/Parser/if-scope-c90.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify --std=c90 %s +// RUN: clang-cc -fsyntax-only -verify -std=c90 %s int f (int z) { diff --git a/test/Parser/if-scope-c99.c b/test/Parser/if-scope-c99.c index b4cb51ca8c4f..0cb2495efce2 100644 --- a/test/Parser/if-scope-c99.c +++ b/test/Parser/if-scope-c99.c @@ -1,4 +1,4 @@ -// RUN: clang-cc -fsyntax-only -verify --std=c99 %s +// RUN: clang-cc -fsyntax-only -verify -std=c99 %s int f (int z) { |