From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Parser/CompoundStmtScope.c | 8 + clang/test/Parser/DelayedTemplateParsing.cpp | 92 ++++++ clang/test/Parser/MicrosoftExtensions.c | 77 +++++ clang/test/Parser/MicrosoftExtensions.cpp | 311 +++++++++++++++++++++ clang/test/Parser/PR11000.cpp | 9 + clang/test/Parser/access-spec-attrs.cpp | 12 + clang/test/Parser/altivec.c | 121 ++++++++ clang/test/Parser/argument_qualified.c | 5 + clang/test/Parser/argument_redef.c | 6 + clang/test/Parser/argument_scope.c | 6 + clang/test/Parser/asm-constraints-pr7869.c | 45 +++ clang/test/Parser/asm.c | 19 ++ clang/test/Parser/asm.cpp | 8 + clang/test/Parser/attr-availability.c | 28 ++ clang/test/Parser/attributes.c | 98 +++++++ clang/test/Parser/backtrack-crash.cpp | 4 + clang/test/Parser/bad-control.c | 9 + clang/test/Parser/block-block-storageclass.c | 17 ++ clang/test/Parser/block-pointer-decl.c | 28 ++ clang/test/Parser/bracket-crash.cpp | 6 + clang/test/Parser/builtin_classify_type.c | 21 ++ clang/test/Parser/builtin_types_compatible.c | 43 +++ clang/test/Parser/c-namespace.c | 6 + clang/test/Parser/c1x-alignas.c | 7 + clang/test/Parser/c1x-generic-selection.c | 10 + clang/test/Parser/char-literal-printing.c | 67 +++++ clang/test/Parser/check-objc2-syntax-1.m | 10 + clang/test/Parser/check-syntax-1.m | 19 ++ clang/test/Parser/check_cast.c | 12 + clang/test/Parser/compound_literal.c | 5 + clang/test/Parser/control-scope.c | 8 + clang/test/Parser/cuda-kernel-call.cu | 9 + clang/test/Parser/cxx-altivec.cpp | 170 +++++++++++ clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp | 16 ++ clang/test/Parser/cxx-ambig-decl-expr.cpp | 10 + clang/test/Parser/cxx-ambig-paren-expr.cpp | 66 +++++ clang/test/Parser/cxx-attributes.cpp | 9 + clang/test/Parser/cxx-bool.cpp | 4 + clang/test/Parser/cxx-casting.cpp | 92 ++++++ clang/test/Parser/cxx-class.cpp | 89 ++++++ clang/test/Parser/cxx-condition.cpp | 15 + clang/test/Parser/cxx-decl.cpp | 129 +++++++++ clang/test/Parser/cxx-default-args.cpp | 16 ++ clang/test/Parser/cxx-default-delete.cpp | 23 ++ clang/test/Parser/cxx-ext-delete-default.cpp | 11 + clang/test/Parser/cxx-extern-c-array.cpp | 7 + clang/test/Parser/cxx-friend.cpp | 40 +++ clang/test/Parser/cxx-in-c.c | 5 + clang/test/Parser/cxx-member-crash.cpp | 15 + .../Parser/cxx-member-init-missing-paren-crash.cpp | 12 + clang/test/Parser/cxx-member-initializers.cpp | 15 + clang/test/Parser/cxx-namespace-alias.cpp | 9 + clang/test/Parser/cxx-reference.cpp | 21 ++ clang/test/Parser/cxx-stmt.cpp | 60 ++++ clang/test/Parser/cxx-template-argument.cpp | 12 + clang/test/Parser/cxx-template-decl.cpp | 115 ++++++++ clang/test/Parser/cxx-throw.cpp | 15 + clang/test/Parser/cxx-typeid.cpp | 13 + clang/test/Parser/cxx-typeof.cpp | 13 + clang/test/Parser/cxx-undeclared-identifier.cpp | 9 + clang/test/Parser/cxx-using-declaration.cpp | 45 +++ clang/test/Parser/cxx-using-directive.cpp | 38 +++ clang/test/Parser/cxx-variadic-func.cpp | 5 + clang/test/Parser/cxx0x-ambig.cpp | 127 +++++++++ clang/test/Parser/cxx0x-attributes.cpp | 83 ++++++ clang/test/Parser/cxx0x-condition.cpp | 37 +++ clang/test/Parser/cxx0x-decl.cpp | 18 ++ clang/test/Parser/cxx0x-for-range.cpp | 30 ++ clang/test/Parser/cxx0x-in-cxx98.cpp | 23 ++ clang/test/Parser/cxx0x-lambda-expressions.cpp | 43 +++ clang/test/Parser/cxx0x-literal-operators.cpp | 8 + clang/test/Parser/cxx0x-member-initializers.cpp | 29 ++ .../Parser/cxx0x-override-control-keywords.cpp | 25 ++ clang/test/Parser/cxx0x-rvalue-reference.cpp | 9 + clang/test/Parser/cxx11-stmt-attributes.cpp | 54 ++++ clang/test/Parser/cxx11-type-specifier.cpp | 20 ++ clang/test/Parser/cxx11-user-defined-literals.cpp | 112 ++++++++ clang/test/Parser/declarators.c | 102 +++++++ clang/test/Parser/designator.c | 17 ++ clang/test/Parser/encode.m | 8 + clang/test/Parser/enhanced-proto-1.m | 17 ++ clang/test/Parser/expressions.c | 59 ++++ clang/test/Parser/expressions.m | 6 + clang/test/Parser/extension.c | 20 ++ clang/test/Parser/for.cpp | 20 ++ clang/test/Parser/function-decls.c | 10 + clang/test/Parser/goto.c | 30 ++ clang/test/Parser/if-scope-c90.c | 8 + clang/test/Parser/if-scope-c99.c | 8 + clang/test/Parser/implicit-casts.c | 21 ++ clang/test/Parser/knr_parameter_attributes.c | 11 + clang/test/Parser/method-def-in-class.m | 14 + clang/test/Parser/method-prototype-1.m | 43 +++ clang/test/Parser/missing-end-2.m | 19 ++ clang/test/Parser/missing-end-3.m | 10 + clang/test/Parser/missing-end-4.m | 51 ++++ clang/test/Parser/missing-end.m | 7 + clang/test/Parser/ms-inline-asm.c | 25 ++ clang/test/Parser/namelookup-bug-1.c | 7 + clang/test/Parser/namelookup-bug-2.c | 14 + clang/test/Parser/namespace-alias-attr.cpp | 8 + clang/test/Parser/namespaces.cpp | 8 + clang/test/Parser/nested-namespaces-recovery.cpp | 24 ++ clang/test/Parser/objc-alias-printing.m | 18 ++ clang/test/Parser/objc-category-neg-1.m | 8 + clang/test/Parser/objc-forcollection-1.m | 43 +++ clang/test/Parser/objc-forcollection-neg-2.m | 38 +++ clang/test/Parser/objc-forcollection-neg.m | 38 +++ clang/test/Parser/objc-foreach-syntax.m | 25 ++ clang/test/Parser/objc-init.m | 60 ++++ clang/test/Parser/objc-interfaces.m | 8 + clang/test/Parser/objc-messaging-1.m | 26 ++ clang/test/Parser/objc-messaging-neg-1.m | 13 + clang/test/Parser/objc-missing-impl.m | 2 + clang/test/Parser/objc-property-syntax.m | 17 ++ clang/test/Parser/objc-quirks.m | 32 +++ clang/test/Parser/objc-synthesized-recover.m | 15 + clang/test/Parser/objc-try-catch-1.m | 70 +++++ clang/test/Parser/objc-type-printing.m | 19 ++ clang/test/Parser/objcxx-at.mm | 15 + clang/test/Parser/objcxx-lambda-expressions-neg.mm | 5 + clang/test/Parser/objcxx0x-lambda-expressions.mm | 23 ++ clang/test/Parser/objcxx11-attributes.mm | 57 ++++ clang/test/Parser/objcxx11-user-defined-literal.mm | 3 + clang/test/Parser/offsetof.c | 7 + clang/test/Parser/opencl-astype.cl | 20 ++ clang/test/Parser/opencl-image-access.cl | 16 ++ clang/test/Parser/opencl-kernel.cl | 9 + clang/test/Parser/opencl-pragma.cl | 15 + clang/test/Parser/opencl-storage-class.cl | 15 + clang/test/Parser/parenthesis-balance.cpp | 15 + clang/test/Parser/parmvardecl_conversion.c | 4 + clang/test/Parser/parser_overflow.c | 7 + clang/test/Parser/placeholder-recovery.m | 12 + clang/test/Parser/pointer-arithmetic.c | 9 + clang/test/Parser/pointer_promotion.c | 17 ++ clang/test/Parser/pragma-options.c | 22 ++ clang/test/Parser/pragma-pack.c | 32 +++ clang/test/Parser/pragma-visibility.c | 9 + clang/test/Parser/pragma-visibility2.c | 19 ++ clang/test/Parser/pragma-weak.c | 17 ++ clang/test/Parser/prefix-attributes.m | 8 + clang/test/Parser/promote_types_in_proto.c | 9 + clang/test/Parser/recovery.c | 100 +++++++ clang/test/Parser/recovery.cpp | 42 +++ clang/test/Parser/recovery.m | 5 + clang/test/Parser/recursion-limits.cpp | 259 +++++++++++++++++ clang/test/Parser/selector-1.m | 20 ++ clang/test/Parser/skip-function-bodies.mm | 45 +++ clang/test/Parser/statements.c | 64 +++++ clang/test/Parser/struct-recursion.c | 11 + clang/test/Parser/switch-recovery.cpp | 172 ++++++++++++ clang/test/Parser/top-level-semi-cxx0x.cpp | 15 + clang/test/Parser/traditional_arg_scope.c | 7 + clang/test/Parser/typeof.c | 26 ++ clang/test/Parser/types.c | 14 + clang/test/Parser/warn-dangling-else.cpp | 55 ++++ 157 files changed, 5042 insertions(+) create mode 100644 clang/test/Parser/CompoundStmtScope.c create mode 100644 clang/test/Parser/DelayedTemplateParsing.cpp create mode 100644 clang/test/Parser/MicrosoftExtensions.c create mode 100644 clang/test/Parser/MicrosoftExtensions.cpp create mode 100644 clang/test/Parser/PR11000.cpp create mode 100644 clang/test/Parser/access-spec-attrs.cpp create mode 100644 clang/test/Parser/altivec.c create mode 100644 clang/test/Parser/argument_qualified.c create mode 100644 clang/test/Parser/argument_redef.c create mode 100644 clang/test/Parser/argument_scope.c create mode 100644 clang/test/Parser/asm-constraints-pr7869.c create mode 100644 clang/test/Parser/asm.c create mode 100644 clang/test/Parser/asm.cpp create mode 100644 clang/test/Parser/attr-availability.c create mode 100644 clang/test/Parser/attributes.c create mode 100644 clang/test/Parser/backtrack-crash.cpp create mode 100644 clang/test/Parser/bad-control.c create mode 100644 clang/test/Parser/block-block-storageclass.c create mode 100644 clang/test/Parser/block-pointer-decl.c create mode 100644 clang/test/Parser/bracket-crash.cpp create mode 100644 clang/test/Parser/builtin_classify_type.c create mode 100644 clang/test/Parser/builtin_types_compatible.c create mode 100644 clang/test/Parser/c-namespace.c create mode 100644 clang/test/Parser/c1x-alignas.c create mode 100644 clang/test/Parser/c1x-generic-selection.c create mode 100644 clang/test/Parser/char-literal-printing.c create mode 100644 clang/test/Parser/check-objc2-syntax-1.m create mode 100644 clang/test/Parser/check-syntax-1.m create mode 100644 clang/test/Parser/check_cast.c create mode 100644 clang/test/Parser/compound_literal.c create mode 100644 clang/test/Parser/control-scope.c create mode 100644 clang/test/Parser/cuda-kernel-call.cu create mode 100644 clang/test/Parser/cxx-altivec.cpp create mode 100644 clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp create mode 100644 clang/test/Parser/cxx-ambig-decl-expr.cpp create mode 100644 clang/test/Parser/cxx-ambig-paren-expr.cpp create mode 100644 clang/test/Parser/cxx-attributes.cpp create mode 100644 clang/test/Parser/cxx-bool.cpp create mode 100644 clang/test/Parser/cxx-casting.cpp create mode 100644 clang/test/Parser/cxx-class.cpp create mode 100644 clang/test/Parser/cxx-condition.cpp create mode 100644 clang/test/Parser/cxx-decl.cpp create mode 100644 clang/test/Parser/cxx-default-args.cpp create mode 100644 clang/test/Parser/cxx-default-delete.cpp create mode 100644 clang/test/Parser/cxx-ext-delete-default.cpp create mode 100644 clang/test/Parser/cxx-extern-c-array.cpp create mode 100644 clang/test/Parser/cxx-friend.cpp create mode 100644 clang/test/Parser/cxx-in-c.c create mode 100644 clang/test/Parser/cxx-member-crash.cpp create mode 100644 clang/test/Parser/cxx-member-init-missing-paren-crash.cpp create mode 100644 clang/test/Parser/cxx-member-initializers.cpp create mode 100644 clang/test/Parser/cxx-namespace-alias.cpp create mode 100644 clang/test/Parser/cxx-reference.cpp create mode 100644 clang/test/Parser/cxx-stmt.cpp create mode 100644 clang/test/Parser/cxx-template-argument.cpp create mode 100644 clang/test/Parser/cxx-template-decl.cpp create mode 100644 clang/test/Parser/cxx-throw.cpp create mode 100644 clang/test/Parser/cxx-typeid.cpp create mode 100644 clang/test/Parser/cxx-typeof.cpp create mode 100644 clang/test/Parser/cxx-undeclared-identifier.cpp create mode 100644 clang/test/Parser/cxx-using-declaration.cpp create mode 100644 clang/test/Parser/cxx-using-directive.cpp create mode 100644 clang/test/Parser/cxx-variadic-func.cpp create mode 100644 clang/test/Parser/cxx0x-ambig.cpp create mode 100644 clang/test/Parser/cxx0x-attributes.cpp create mode 100644 clang/test/Parser/cxx0x-condition.cpp create mode 100644 clang/test/Parser/cxx0x-decl.cpp create mode 100644 clang/test/Parser/cxx0x-for-range.cpp create mode 100644 clang/test/Parser/cxx0x-in-cxx98.cpp create mode 100644 clang/test/Parser/cxx0x-lambda-expressions.cpp create mode 100644 clang/test/Parser/cxx0x-literal-operators.cpp create mode 100644 clang/test/Parser/cxx0x-member-initializers.cpp create mode 100644 clang/test/Parser/cxx0x-override-control-keywords.cpp create mode 100644 clang/test/Parser/cxx0x-rvalue-reference.cpp create mode 100644 clang/test/Parser/cxx11-stmt-attributes.cpp create mode 100644 clang/test/Parser/cxx11-type-specifier.cpp create mode 100644 clang/test/Parser/cxx11-user-defined-literals.cpp create mode 100644 clang/test/Parser/declarators.c create mode 100644 clang/test/Parser/designator.c create mode 100644 clang/test/Parser/encode.m create mode 100644 clang/test/Parser/enhanced-proto-1.m create mode 100644 clang/test/Parser/expressions.c create mode 100644 clang/test/Parser/expressions.m create mode 100644 clang/test/Parser/extension.c create mode 100644 clang/test/Parser/for.cpp create mode 100644 clang/test/Parser/function-decls.c create mode 100644 clang/test/Parser/goto.c create mode 100644 clang/test/Parser/if-scope-c90.c create mode 100644 clang/test/Parser/if-scope-c99.c create mode 100644 clang/test/Parser/implicit-casts.c create mode 100644 clang/test/Parser/knr_parameter_attributes.c create mode 100644 clang/test/Parser/method-def-in-class.m create mode 100644 clang/test/Parser/method-prototype-1.m create mode 100644 clang/test/Parser/missing-end-2.m create mode 100644 clang/test/Parser/missing-end-3.m create mode 100644 clang/test/Parser/missing-end-4.m create mode 100644 clang/test/Parser/missing-end.m create mode 100644 clang/test/Parser/ms-inline-asm.c create mode 100644 clang/test/Parser/namelookup-bug-1.c create mode 100644 clang/test/Parser/namelookup-bug-2.c create mode 100644 clang/test/Parser/namespace-alias-attr.cpp create mode 100644 clang/test/Parser/namespaces.cpp create mode 100644 clang/test/Parser/nested-namespaces-recovery.cpp create mode 100644 clang/test/Parser/objc-alias-printing.m create mode 100644 clang/test/Parser/objc-category-neg-1.m create mode 100644 clang/test/Parser/objc-forcollection-1.m create mode 100644 clang/test/Parser/objc-forcollection-neg-2.m create mode 100644 clang/test/Parser/objc-forcollection-neg.m create mode 100644 clang/test/Parser/objc-foreach-syntax.m create mode 100644 clang/test/Parser/objc-init.m create mode 100644 clang/test/Parser/objc-interfaces.m create mode 100644 clang/test/Parser/objc-messaging-1.m create mode 100644 clang/test/Parser/objc-messaging-neg-1.m create mode 100644 clang/test/Parser/objc-missing-impl.m create mode 100644 clang/test/Parser/objc-property-syntax.m create mode 100644 clang/test/Parser/objc-quirks.m create mode 100644 clang/test/Parser/objc-synthesized-recover.m create mode 100644 clang/test/Parser/objc-try-catch-1.m create mode 100644 clang/test/Parser/objc-type-printing.m create mode 100644 clang/test/Parser/objcxx-at.mm create mode 100644 clang/test/Parser/objcxx-lambda-expressions-neg.mm create mode 100644 clang/test/Parser/objcxx0x-lambda-expressions.mm create mode 100644 clang/test/Parser/objcxx11-attributes.mm create mode 100644 clang/test/Parser/objcxx11-user-defined-literal.mm create mode 100644 clang/test/Parser/offsetof.c create mode 100644 clang/test/Parser/opencl-astype.cl create mode 100644 clang/test/Parser/opencl-image-access.cl create mode 100644 clang/test/Parser/opencl-kernel.cl create mode 100644 clang/test/Parser/opencl-pragma.cl create mode 100644 clang/test/Parser/opencl-storage-class.cl create mode 100644 clang/test/Parser/parenthesis-balance.cpp create mode 100644 clang/test/Parser/parmvardecl_conversion.c create mode 100644 clang/test/Parser/parser_overflow.c create mode 100644 clang/test/Parser/placeholder-recovery.m create mode 100644 clang/test/Parser/pointer-arithmetic.c create mode 100644 clang/test/Parser/pointer_promotion.c create mode 100644 clang/test/Parser/pragma-options.c create mode 100644 clang/test/Parser/pragma-pack.c create mode 100644 clang/test/Parser/pragma-visibility.c create mode 100644 clang/test/Parser/pragma-visibility2.c create mode 100644 clang/test/Parser/pragma-weak.c create mode 100644 clang/test/Parser/prefix-attributes.m create mode 100644 clang/test/Parser/promote_types_in_proto.c create mode 100644 clang/test/Parser/recovery.c create mode 100644 clang/test/Parser/recovery.cpp create mode 100644 clang/test/Parser/recovery.m create mode 100644 clang/test/Parser/recursion-limits.cpp create mode 100644 clang/test/Parser/selector-1.m create mode 100644 clang/test/Parser/skip-function-bodies.mm create mode 100644 clang/test/Parser/statements.c create mode 100644 clang/test/Parser/struct-recursion.c create mode 100644 clang/test/Parser/switch-recovery.cpp create mode 100644 clang/test/Parser/top-level-semi-cxx0x.cpp create mode 100644 clang/test/Parser/traditional_arg_scope.c create mode 100644 clang/test/Parser/typeof.c create mode 100644 clang/test/Parser/types.c create mode 100644 clang/test/Parser/warn-dangling-else.cpp (limited to 'clang/test/Parser') diff --git a/clang/test/Parser/CompoundStmtScope.c b/clang/test/Parser/CompoundStmtScope.c new file mode 100644 index 0000000..4f99103 --- /dev/null +++ b/clang/test/Parser/CompoundStmtScope.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void foo() { + { + typedef float X; + } + X Y; // expected-error {{use of undeclared identifier}} +} diff --git a/clang/test/Parser/DelayedTemplateParsing.cpp b/clang/test/Parser/DelayedTemplateParsing.cpp new file mode 100644 index 0000000..9737c73 --- /dev/null +++ b/clang/test/Parser/DelayedTemplateParsing.cpp @@ -0,0 +1,92 @@ +// RUN: %clang_cc1 -fms-extensions -fdelayed-template-parsing -fsyntax-only -verify %s + +template +class A { + void foo() { + undeclared(); + } + void foo2(); +}; + +template +class B { + void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}} + void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}} expected-note {{previous definition is here}} + + friend void foo3() { + undeclared(); + } +}; + + +template +void B::foo4() {// expected-error {{redefinition of 'foo4'}} +} + +template +void A::foo2() { + undeclared(); +} + + +template +void foo3() { + undeclared(); +} + +template void A::foo2(); + + +void undeclared() +{ + +} + +template void foo5() {} //expected-note {{previous definition is here}} +template void foo5() {} // expected-error {{redefinition of 'foo5'}} + + + +namespace Inner_Outer_same_template_param_name { + +template +class Outmost { +public: + template + class Inner { + public: + void f() { + T* var; + } + }; +}; + +} + + +namespace PR11931 { + +template +struct BindState; + + template<> +struct BindState { + static void Run() { } +}; + +class Callback { +public: + typedef void RunType(); + + template + Callback(BindState bind_state) { + BindState::Run(); + } +}; + + +Callback Bind() { + return Callback(BindState()); +} + +} diff --git a/clang/test/Parser/MicrosoftExtensions.c b/clang/test/Parser/MicrosoftExtensions.c new file mode 100644 index 0000000..1ef326a --- /dev/null +++ b/clang/test/Parser/MicrosoftExtensions.c @@ -0,0 +1,77 @@ +// RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -verify -fms-extensions -Wno-missing-declarations -x objective-c++ %s +__stdcall int func0(); +int __stdcall func(); +typedef int (__cdecl *tptr)(); +void (*__fastcall fastpfunc)(); +struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) __declspec(novtable) IUnknown {}; +extern __declspec(dllimport) void __stdcall VarR4FromDec(); +__declspec(deprecated) __declspec(deprecated) char * __cdecl ltoa( long _Val, char * _DstBuf, int _Radix); +__declspec(noalias) __declspec(restrict) void * __cdecl xxx( void * _Memory ); +typedef __w64 unsigned long ULONG_PTR, *PULONG_PTR; + +void * __ptr64 PtrToPtr64(const void *p) +{ + return((void * __ptr64) (unsigned __int64) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr64' ignored}} +} +void * __ptr32 PtrToPtr32(const void *p) +{ + return((void * __ptr32) (unsigned __int32) (ULONG_PTR)p ); // expected-warning {{unknown attribute '__ptr32' ignored}} +} + +void __forceinline InterlockedBitTestAndSet (long *Base, long Bit) +{ + __asm { + mov eax, Bit + mov ecx, Base + lock bts [ecx], eax + setc al + }; +} +_inline int foo99() { return 99; } + +void *_alloca(int); + +void foo() { + __declspec(align(16)) int *buffer = (int *)_alloca(9); +} + +typedef bool (__stdcall __stdcall *blarg)(int); + +void local_callconv() +{ + bool (__stdcall *p)(int); +} + +// Charify extension. +#define FOO(x) #@x +char x = FOO(a); + +typedef enum E { e1 }; + + +enum __declspec(deprecated) E2 { i, j, k }; +__declspec(deprecated) enum E3 { a, b, c } e; + +void deprecated_enum_test(void) +{ + // Test to make sure the deprecated warning follows the right thing + enum E2 e1; // expected-warning {{'E2' is deprecated}} + enum E3 e2; // No warning expected, the deprecation follows the variable + enum E3 e3 = e; // expected-warning {{'e' is deprecated}} +} + +/* Microsoft attribute tests */ +[repeatable][source_annotation_attribute( Parameter|ReturnValue )] +struct SA_Post{ SA_Post(); int attr; }; + +[returnvalue:SA_Post( attr=1)] +int foo1([SA_Post(attr=1)] void *param); + + + +void ms_intrinsics(int a) +{ + __noop(); + __assume(a); + __debugbreak(); +} diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp new file mode 100644 index 0000000..3a1ffea --- /dev/null +++ b/clang/test/Parser/MicrosoftExtensions.cpp @@ -0,0 +1,311 @@ +// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions -fms-compatibility -fdelayed-template-parsing + +/* Microsoft attribute tests */ +[repeatable][source_annotation_attribute( Parameter|ReturnValue )] +struct SA_Post{ SA_Post(); int attr; }; + +[returnvalue:SA_Post( attr=1)] +int foo1([SA_Post(attr=1)] void *param); + +namespace { + [returnvalue:SA_Post(attr=1)] + int foo2([SA_Post(attr=1)] void *param); +} + +class T { + [returnvalue:SA_Post(attr=1)] + int foo3([SA_Post(attr=1)] void *param); +}; + +extern "C" { + [returnvalue:SA_Post(attr=1)] + int foo5([SA_Post(attr=1)] void *param); +} + +class class_attr { +public: + class_attr([SA_Pre(Null=SA_No,NullTerminated=SA_Yes)] int a) + { + } +}; + + + +void uuidof_test1() +{ + __uuidof(0); // expected-error {{you need to include before using the '__uuidof' operator}} +} + +typedef struct _GUID +{ + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8]; +} GUID; + +struct __declspec(uuid(L"00000000-0000-0000-1234-000000000047")) uuid_attr_bad1 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}} +struct __declspec(uuid(3)) uuid_attr_bad2 { };// expected-error {{'uuid' attribute requires parameter 1 to be a string}} +struct __declspec(uuid("0000000-0000-0000-1234-0000500000047")) uuid_attr_bad3 { };// expected-error {{uuid attribute contains a malformed GUID}} +struct __declspec(uuid("0000000-0000-0000-Z234-000000000047")) uuid_attr_bad4 { };// expected-error {{uuid attribute contains a malformed GUID}} +struct __declspec(uuid("000000000000-0000-1234-000000000047")) uuid_attr_bad5 { };// expected-error {{uuid attribute contains a malformed GUID}} + + + +struct __declspec(uuid("000000A0-0000-0000-C000-000000000046")) +struct_with_uuid { }; +struct struct_without_uuid { }; + +struct __declspec(uuid("000000A0-0000-0000-C000-000000000049")) +struct_with_uuid2; + +struct +struct_with_uuid2 {} ; + +int uuid_sema_test() +{ + struct_with_uuid var_with_uuid[1]; + struct_without_uuid var_without_uuid[1]; + + __uuidof(struct_with_uuid); + __uuidof(struct_with_uuid2); + __uuidof(struct_without_uuid); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(struct_with_uuid*); + __uuidof(struct_without_uuid*); // expected-error {{cannot call operator __uuidof on a type with no GUID}} + + __uuidof(var_with_uuid); + __uuidof(var_without_uuid);// expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(var_with_uuid[1]); + __uuidof(var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}} + __uuidof(&var_with_uuid[1]); + __uuidof(&var_without_uuid[1]);// expected-error {{cannot call operator __uuidof on a type with no GUID}} + + __uuidof(0); + __uuidof(1);// expected-error {{cannot call operator __uuidof on a type with no GUID}} +} + + +template +void template_uuid() +{ + T expr; + + __uuidof(T); + __uuidof(expr); +} + + +template +class COM_CLASS_TEMPLATE { }; + +typedef COM_CLASS_TEMPLATE COM_TYPE_1; +typedef COM_CLASS_TEMPLATE COM_TYPE_2; + +template +class COM_CLASS_TEMPLATE_REF { }; +typedef COM_CLASS_TEMPLATE_REF COM_TYPE_REF; + + struct late_defined_uuid; + template + void test_late_defined_uuid() { + __uuidof(late_defined_uuid); + } + struct __declspec(uuid("000000A0-0000-0000-C000-000000000049")) late_defined_uuid; + + +class CtorCall { +public: + CtorCall& operator=(const CtorCall& that); + + int a; +}; + +CtorCall& CtorCall::operator=(const CtorCall& that) +{ + if (this != &that) { + this->CtorCall::~CtorCall(); + this->CtorCall::CtorCall(that); // expected-warning {{explicit constructor calls are a Microsoft extension}} + } + return *this; +} + +template +class C1 { +public: + template + class Iterator { + }; +}; + +template +class C2 { + typename C1:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}} +}; + +template +void missing_template_keyword(){ + typename C1:: /*template*/ Iterator<0> Mypos; // expected-warning {{use 'template' keyword to treat 'Iterator' as a dependent template name}} +} + + + +class AAAA { }; + +template +void redundant_typename() { + typename T t;// expected-warning {{expected a qualified name after 'typename'}} + typename AAAA a;// expected-warning {{expected a qualified name after 'typename'}} + t = 3; +} + + +__interface MicrosoftInterface; +__interface MicrosoftInterface { + virtual void foo1() = 0; + virtual void foo2() = 0; +}; + +void interface_test() { + MicrosoftInterface* a; + a->foo1(); +} + +__int64 x7 = __int64(0); + + +namespace If_exists_test { + +class IF_EXISTS { +private: + typedef int Type; +}; + +int __if_exists_test() { + int b=0; + __if_exists(IF_EXISTS::Type) { + b++; + b++; + } + __if_exists(IF_EXISTS::Type_not) { + this wont compile. + } + __if_not_exists(IF_EXISTS::Type) { + this wont compile. + } + __if_not_exists(IF_EXISTS::Type_not) { + b++; + b++; + } +} + + +__if_exists(IF_EXISTS::Type) { + int var23; +} + +__if_exists(IF_EXISTS::Type_not) { + this wont compile. +} + +__if_not_exists(IF_EXISTS::Type) { + this wont compile. +} + +__if_not_exists(IF_EXISTS::Type_not) { + int var244; +} + +int __if_exists_init_list() { + + int array1[] = { + 0, + __if_exists(IF_EXISTS::Type) {2, } + 3 + }; + + int array2[] = { + 0, + __if_exists(IF_EXISTS::Type_not) { this wont compile } + 3 + }; + + int array3[] = { + 0, + __if_not_exists(IF_EXISTS::Type_not) {2, } + 3 + }; + + int array4[] = { + 0, + __if_not_exists(IF_EXISTS::Type) { this wont compile } + 3 + }; + +} + + +class IF_EXISTS_CLASS_TEST { + __if_exists(IF_EXISTS::Type) { + // __if_exists, __if_not_exists can nest + __if_not_exists(IF_EXISTS::Type_not) { + int var123; + } + int var23; + } + + __if_exists(IF_EXISTS::Type_not) { + this wont compile. + } + + __if_not_exists(IF_EXISTS::Type) { + this wont compile. + } + + __if_not_exists(IF_EXISTS::Type_not) { + int var244; + } +}; + +} + + +int __identifier(generic) = 3; + +class inline_definition_pure_spec { + virtual int f() = 0 { return 0; }// expected-warning {{function definition with pure-specifier is a Microsoft extension}} + virtual int f2() = 0; +}; + + +int main () { + // Necessary to force instantiation in -fdelayed-template-parsing mode. + test_late_defined_uuid(); + redundant_typename(); + missing_template_keyword(); +} + + + + +namespace access_protected_PTM { + +class A { +protected: + void f(); // expected-note {{must name member using the type of the current context 'access_protected_PTM::B'}} +}; + +class B : public A{ +public: + void test_access(); + static void test_access_static(); +}; + +void B::test_access() { + &A::f; // expected-error {{'f' is a protected member of 'access_protected_PTM::A'}} +} + +void B::test_access_static() { + &A::f; +} + +} \ No newline at end of file diff --git a/clang/test/Parser/PR11000.cpp b/clang/test/Parser/PR11000.cpp new file mode 100644 index 0000000..7dae996 --- /dev/null +++ b/clang/test/Parser/PR11000.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -std=c++11 %s 2>&1 | FileCheck %s + +// PR11000: Don't crash. +class tuple<> +{ + template + tuple(allocator_arg_t, const _Alloc&) {} + +// CHECK: 6 errors generated. diff --git a/clang/test/Parser/access-spec-attrs.cpp b/clang/test/Parser/access-spec-attrs.cpp new file mode 100644 index 0000000..4fa5975 --- /dev/null +++ b/clang/test/Parser/access-spec-attrs.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify + +struct X { +public __attribute__((unavailable)): // expected-error {{access specifier can only have annotation attributes}} + void foo(); +private __attribute__((annotate("foobar"))): + void bar(); +}; + +void f(X x) { + x.foo(); +} diff --git a/clang/test/Parser/altivec.c b/clang/test/Parser/altivec.c new file mode 100644 index 0000000..d1e6552 --- /dev/null +++ b/clang/test/Parser/altivec.c @@ -0,0 +1,121 @@ +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s + +__vector char vv_c; +__vector signed char vv_sc; +__vector unsigned char vv_uc; +__vector short vv_s; +__vector signed short vv_ss; +__vector unsigned short vv_us; +__vector short int vv_si; +__vector signed short int vv_ssi; +__vector unsigned short int vv_usi; +__vector int vv_i; +__vector signed int vv_sint; +__vector unsigned int vv_ui; +__vector float vv_f; +__vector bool char vv_bc; +__vector bool short vv_bs; +__vector bool int vv_bi; +__vector __pixel vv_p; +__vector pixel vv__p; +__vector int vf__r(); +void vf__a(__vector int a); +void vf__a2(int b, __vector int a); + +vector char v_c; +vector signed char v_sc; +vector unsigned char v_uc; +vector short v_s; +vector signed short v_ss; +vector unsigned short v_us; +vector short int v_si; +vector signed short int v_ssi; +vector unsigned short int v_usi; +vector int v_i; +vector signed int v_sint; +vector unsigned int v_ui; +vector float v_f; +vector bool char v_bc; +vector bool short v_bs; +vector bool int v_bi; +vector __pixel v_p; +vector pixel v__p; +vector int f__r(); +void f_a(vector int a); +void f_a2(int b, vector int a); + +vector int v = (vector int)(-1); + +// These should have warnings. +__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long vv_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long int vv_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long int vv_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long int vv_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long v_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long v_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long v_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long int v_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long int v_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector bool v_b; // expected-warning {{type specifier missing, defaults to 'int'}} + +// These should have errors. +__vector double vv_d1; // expected-error {{cannot use 'double' with '__vector'}} +vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}} +__vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}} +vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}} +vector bool pixel v_bp; // expected-error {{cannot use '__pixel' with '__vector bool'}} +vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}} +vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}} +vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}} +vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}} + +void f() { + __vector unsigned int v = {0,0,0,0}; + __vector int v__cast = (__vector int)v; + __vector int v_cast = (vector int)v; + __vector char vb_cast = (vector char)v; + + // Check some casting between gcc and altivec vectors. + #define gccvector __attribute__((vector_size(16))) + gccvector unsigned int gccv = {0,0,0,0}; + gccvector unsigned int gccv1 = gccv; + gccvector int gccv2 = (gccvector int)gccv; + gccvector unsigned int gccv3 = v; + __vector unsigned int av = gccv; + __vector int avi = (__vector int)gccv; + gccvector unsigned int gv = v; + gccvector int gvi = (gccvector int)v; + __attribute__((vector_size(8))) unsigned int gv8; + gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}} + av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} + + v = gccv; + __vector unsigned int tv = gccv; + gccv = v; + gccvector unsigned int tgv = v; + + int res_i; + // bug 7553 - Problem with '==' and vectors + res_i = (vv_sc == vv_sc); + res_i = (vv_uc != vv_uc); + res_i = (vv_s > vv_s); + res_i = (vv_us >= vv_us); + res_i = (vv_i < vv_i); + res_i = (vv_ui <= vv_ui); + res_i = (vv_f <= vv_f); +} + +// bug 6895 - Vectorl literal casting confusion. +vector char v1 = (vector char)((vector int)(1, 2, 3, 4)); +vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f)); +vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd')); +vector int v4 = (vector int)(1, 2, 3, 4); +vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f); +vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3))); diff --git a/clang/test/Parser/argument_qualified.c b/clang/test/Parser/argument_qualified.c new file mode 100644 index 0000000..7d1b9fd --- /dev/null +++ b/clang/test/Parser/argument_qualified.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 %s +int abc (const float x) { + return 1; +} + diff --git a/clang/test/Parser/argument_redef.c b/clang/test/Parser/argument_redef.c new file mode 100644 index 0000000..519e8fd --- /dev/null +++ b/clang/test/Parser/argument_redef.c @@ -0,0 +1,6 @@ +/* RUN: %clang_cc1 -fsyntax-only -verify %s +*/ + +void foo(int A) { /* expected-note {{previous definition is here}} */ + int A; /* expected-error {{redefinition of 'A'}} */ +} diff --git a/clang/test/Parser/argument_scope.c b/clang/test/Parser/argument_scope.c new file mode 100644 index 0000000..d2d10c2 --- /dev/null +++ b/clang/test/Parser/argument_scope.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only %s +typedef struct foo foo; + +void blah(int foo) { + foo = 1; +} diff --git a/clang/test/Parser/asm-constraints-pr7869.c b/clang/test/Parser/asm-constraints-pr7869.c new file mode 100644 index 0000000..db36991 --- /dev/null +++ b/clang/test/Parser/asm-constraints-pr7869.c @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 %s + +int a, b, c, d, e, f, g, h, i, j, k, l; + +void +f1 (void) +{ + __asm__ volatile ("" + : [a] "+r" (a), [b] "+r" (b), [c] "+r" (c), [d] "+r" (d), + [e] "+r" (e), [f] "+r" (f), [g] "+r" (g), [h] "+r" (h), + [i] "+r" (i), [j] "+r" (j), [k] "+r" (k), [l] "+r" (l)); +} + +void +f2 (void) +{ + __asm__ volatile ("" + : [a] "+r,m" (a), [b] "+r,m" (b), [c] "+r,m" (c), [d] "+r,m" (d), + [e] "+r,m" (e), [f] "+r,m" (f), [g] "+r,m" (g), [h] "+r,m" (h), + [i] "+r,m" (i), [j] "+r,m" (j), [k] "+r,m" (k), [l] "+r,m" (l)); +} + +void +f3 (void) +{ + __asm__ volatile ("" + : [a] "=r" (a), [b] "=r" (b), [c] "=r" (c), [d] "=r" (d), + [e] "=r" (e), [f] "=r" (f), [g] "=r" (g), [h] "=r" (h), + [i] "=r" (i), [j] "=r" (j), [k] "=r" (k), [l] "=r" (l) + : "[a]" (a), "[b]" (b), "[c]" (c), "[d]" (d), + "[e]" (e), "[f]" (f), "[g]" (g), "[h]" (h), + "[i]" (i), "[j]" (j), "[k]" (k), "[l]" (l)); +} + +void +f4 (void) +{ + __asm__ volatile ("" + : [a] "=r,m" (a), [b] "=r,m" (b), [c] "=r,m" (c), [d] "=r,m" (d), + [e] "=r,m" (e), [f] "=r,m" (f), [g] "=r,m" (g), [h] "=r,m" (h), + [i] "=r,m" (i), [j] "=r,m" (j), [k] "=r,m" (k), [l] "=r,m" (l) + : "[a],m" (a), "[b],m" (b), "[c],m" (c), "[d],m" (d), + "[e],m" (e), "[f],m" (f), "[g],m" (g), "[h],m" (h), + "[i],m" (i), "[j],m" (j), "[k],m" (k), "[l],m" (l)); +} diff --git a/clang/test/Parser/asm.c b/clang/test/Parser/asm.c new file mode 100644 index 0000000..23052c3 --- /dev/null +++ b/clang/test/Parser/asm.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void f1() { + // PR7673: Some versions of GCC support an empty clobbers section. + asm ("ret" : : :); +} + +void f2() { + asm("foo" : "=r" (a)); // expected-error {{use of undeclared identifier 'a'}} + asm("foo" : : "r" (b)); // expected-error {{use of undeclared identifier 'b'}} +} + + +// rdar://5952468 +__asm ; // expected-error {{expected '(' after 'asm'}} + +// - Don't crash on wide string literals in 'asm'. +int foo asm (L"bar"); // expected-error {{cannot use wide string literal in 'asm'}} + diff --git a/clang/test/Parser/asm.cpp b/clang/test/Parser/asm.cpp new file mode 100644 index 0000000..35a497c --- /dev/null +++ b/clang/test/Parser/asm.cpp @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s + +int foo1 asm ("bar1"); +int foo2 asm (L"bar2"); // expected-error {{cannot use wide string literal in 'asm'}} +int foo3 asm (u8"bar3"); // expected-error {{cannot use unicode string literal in 'asm'}} +int foo4 asm (u"bar4"); // expected-error {{cannot use unicode string literal in 'asm'}} +int foo5 asm (U"bar5"); // expected-error {{cannot use unicode string literal in 'asm'}} +int foo6 asm ("bar6"_x); // expected-error {{string literal with user-defined suffix cannot be used here}} diff --git a/clang/test/Parser/attr-availability.c b/clang/test/Parser/attr-availability.c new file mode 100644 index 0000000..b9ff31c --- /dev/null +++ b/clang/test/Parser/attr-availability.c @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +#if !__has_feature(attribute_availability) +# error 'availability' attribute is not available +#endif + +void f0() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6))); + +void f1() __attribute__((availability(macosx,deprecated=10.4,introduced=10.2,obsoleted=10.6))); + +void f2() __attribute__((availability(ios,deprecated=10.4.7,introduced=10,obsoleted=10.6))); + +void f3() __attribute__((availability(ios,deprecated=10.4.7,introduced=10,obsoleted=10.6,introduced=10.2))); // expected-error{{redundant 'introduced' availability change; only the last specified change will be used}} + +void f4() __attribute__((availability(macosx,introduced=10.5), availability(ios,unavailable))); + +void f5() __attribute__((availability(macosx,introduced=10.5), availability(ios,unavailable, unavailable))); // expected-error{{redundant 'unavailable' availability change; only the last specified change will be used}} + +void f6() __attribute__((availability(macosx,unavailable,introduced=10.5))); // expected-warning{{'unavailable' availability overrides all other availability information}} + +// rdar://10095131 +enum E{ + gorf __attribute__((availability(macosx,introduced=8.5, message = 10.0))), // expected-error {{expected string literal}} + garf __attribute__((availability(macosx,introduced=8.5, message))), // expected-error {{expected '=' after 'message'}} + + foo __attribute__((availability(macosx,introduced=8.5,deprecated=9.0, message="Use CTFontCopyPostScriptName()", deprecated=10.0))) // expected-error {{expected ')'}} \ + // expected-note {{to match this '('}} +}; diff --git a/clang/test/Parser/attributes.c b/clang/test/Parser/attributes.c new file mode 100644 index 0000000..347cb9c --- /dev/null +++ b/clang/test/Parser/attributes.c @@ -0,0 +1,98 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -pedantic -std=c99 + +int __attribute__(()) x; + +__inline void __attribute__((__always_inline__, __nodebug__)) +foo(void) { +} + + +__attribute__(()) y; // expected-warning {{defaults to 'int'}} + +// PR2796 +int (__attribute__(()) *z)(long y); + + +void f1(__attribute__(()) int x); + +int f2(y, __attribute__(()) x); // expected-error {{expected identifier}} + +// This is parsed as a normal argument list (with two args that are implicit +// int) because the __attribute__ is a declspec. +void f3(__attribute__(()) x, // expected-warning {{defaults to 'int'}} + y); // expected-warning {{defaults to 'int'}} + +void f4(__attribute__(())); // expected-error {{expected parameter declarator}} + + +// This is ok, the __attribute__ applies to the pointer. +int baz(int (__attribute__(()) *x)(long y)); + +void g1(void (*f1)(__attribute__(()) int x)); +void g2(int (*f2)(y, __attribute__(()) x)); // expected-error {{expected identifier}} +void g3(void (*f3)(__attribute__(()) x, int y)); // expected-warning {{defaults to 'int'}} +void g4(void (*f4)(__attribute__(()))); // expected-error {{expected parameter declarator}} + + +void (*h1)(void (*f1)(__attribute__(()) int x)); +void (*h2)(int (*f2)(y, __attribute__(()) x)); // expected-error {{expected identifier}} + +void (*h3)(void (*f3)(__attribute__(()) x)); // expected-warning {{defaults to 'int'}} +void (*h4)(void (*f4)(__attribute__(()))); // expected-error {{expected parameter declarator}} + + + +// rdar://6131260 +int foo42(void) { + int x, __attribute__((unused)) y, z; + return 0; +} + +// rdar://6096491 +void __attribute__((noreturn)) d0(void), __attribute__((noreturn)) d1(void); + +void d2(void) __attribute__((noreturn)), d3(void) __attribute__((noreturn)); + + +// PR6287 +void __attribute__((returns_twice)) returns_twice_test(); + +int aligned(int); +int __attribute__((vec_type_hint(char, aligned(16) )) missing_rparen_1; // expected-error {{expected ')'}} +int __attribute__((mode(x aligned(16) )) missing_rparen_2; // expected-error {{expected ')'}} +int __attribute__((format(printf, 0 aligned(16) )) missing_rparen_3; // expected-error {{expected ')'}} + + + +int testFundef1(int *a) __attribute__((nonnull(1))) { // \ + // expected-warning {{GCC does not allow nonnull attribute in this position on a function definition}} + return *a; +} + +// noreturn is lifted to type qualifier +void testFundef2() __attribute__((noreturn)) { // \ + // expected-warning {{GCC does not allow noreturn attribute in this position on a function definition}} + testFundef2(); +} + +int testFundef3(int *a) __attribute__((nonnull(1), // \ + // expected-warning {{GCC does not allow nonnull attribute in this position on a function definition}} + pure)) { // \ + // expected-warning {{GCC does not allow pure attribute in this position on a function definition}} + return *a; +} + +int testFundef4(int *a) __attribute__((nonnull(1))) // \ + // expected-warning {{GCC does not allow nonnull attribute in this position on a function definition}} + __attribute((pure)) { // \ + // expected-warning {{GCC does not allow pure attribute in this position on a function definition}} + return *a; +} + +// GCC allows these +void testFundef5() __attribute__(()) { } + +__attribute__((pure)) int testFundef6(int a) { return a; } + + + diff --git a/clang/test/Parser/backtrack-crash.cpp b/clang/test/Parser/backtrack-crash.cpp new file mode 100644 index 0000000..cc26873 --- /dev/null +++ b/clang/test/Parser/backtrack-crash.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 %s -fsyntax-only -verify -pedantic +// PR7072 +()( // expected-error {{expected unqualified-id}} + diff --git a/clang/test/Parser/bad-control.c b/clang/test/Parser/bad-control.c new file mode 100644 index 0000000..480d81b --- /dev/null +++ b/clang/test/Parser/bad-control.c @@ -0,0 +1,9 @@ +/* RUN: %clang_cc1 -fsyntax-only -verify %s +*/ +void foo() { + break; /* expected-error {{'break' statement not in loop or switch statement}} */ +} + +void foo2() { + continue; /* expected-error {{'continue' statement not in loop statement}} */ +} diff --git a/clang/test/Parser/block-block-storageclass.c b/clang/test/Parser/block-block-storageclass.c new file mode 100644 index 0000000..97ba113 --- /dev/null +++ b/clang/test/Parser/block-block-storageclass.c @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -fblocks -verify %s +int printf(const char *, ...); +void _Block_byref_release(void*src){} + +int main() { + __block int X = 1234; + __block const char * message = "HELLO"; + + X = X - 1234; + + X += 1; + + printf ("%s(%d)\n", message, X); + X -= 1; + + return X; +} diff --git a/clang/test/Parser/block-pointer-decl.c b/clang/test/Parser/block-pointer-decl.c new file mode 100644 index 0000000..a8cc258 --- /dev/null +++ b/clang/test/Parser/block-pointer-decl.c @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -fblocks %s + +int printf(char const *, ...); + +struct blockStruct { + int (^a)(float, int); + int b; +}; + +int blockTaker (int (^myBlock)(int), int other_input) +{ + return 5 * myBlock (other_input); +} + +int main (int argc, char **argv) +{ + int (^blockptr) (int) = ^(int inval) { + printf ("Inputs: %d, %d.\n", argc, inval); + return argc * inval; + }; + + + argc = 10; + printf ("I got: %d.\n", + blockTaker (blockptr, 6)); + return 0; +} + diff --git a/clang/test/Parser/bracket-crash.cpp b/clang/test/Parser/bracket-crash.cpp new file mode 100644 index 0000000..bcc6eab --- /dev/null +++ b/clang/test/Parser/bracket-crash.cpp @@ -0,0 +1,6 @@ +// RUN: not %clang_cc1 -fsyntax-only -std=c++11 %s +// PR7481 +decltype(; +struct{ + a +} diff --git a/clang/test/Parser/builtin_classify_type.c b/clang/test/Parser/builtin_classify_type.c new file mode 100644 index 0000000..a7c0855 --- /dev/null +++ b/clang/test/Parser/builtin_classify_type.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct foo { int a; }; + +int main() { + int a; + float b; + double d; + struct foo s; + + static int ary[__builtin_classify_type(a)]; + static int ary2[(__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}} + static int ary3[(*__builtin_classify_type)(a)]; // expected-error{{variable length array declaration can not have 'static' storage duration}} + + int result; + + result = __builtin_classify_type(a); + result = __builtin_classify_type(b); + result = __builtin_classify_type(d); + result = __builtin_classify_type(s); +} diff --git a/clang/test/Parser/builtin_types_compatible.c b/clang/test/Parser/builtin_types_compatible.c new file mode 100644 index 0000000..ac81e7b --- /dev/null +++ b/clang/test/Parser/builtin_types_compatible.c @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +extern int funcInt(int); +extern float funcFloat(float); +extern double funcDouble(double); +// figure out why "char *" doesn't work (with gcc, nothing to do with clang) +//extern void funcCharPtr(char *); + +#define func(expr) \ + do { \ + typeof(expr) tmp; \ + if (__builtin_types_compatible_p(typeof(expr), int)) funcInt(tmp); \ + else if (__builtin_types_compatible_p(typeof(expr), float)) funcFloat(tmp); \ + else if (__builtin_types_compatible_p(typeof(expr), double)) funcDouble(tmp); \ + } while (0) +#define func_choose(expr) \ + __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), int), funcInt(expr), \ + __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), float), funcFloat(expr), \ + __builtin_choose_expr(__builtin_types_compatible_p(typeof(expr), double), funcDouble(expr), (void)0))) + +static void test() +{ + int a; + float b; + double d; + + func(a); + func(b); + func(d); + a = func_choose(a); + b = func_choose(b); + d = func_choose(d); + + int c; + struct xx { int a; } x, y; + + c = __builtin_choose_expr(a+3-7, b, x); // expected-error{{'__builtin_choose_expr' requires a constant expression}} + c = __builtin_choose_expr(0, b, x); // expected-error{{assigning to 'int' from incompatible type 'struct xx'}} + c = __builtin_choose_expr(5+3-7, b, x); + y = __builtin_choose_expr(4+3-7, b, x); + +} + diff --git a/clang/test/Parser/c-namespace.c b/clang/test/Parser/c-namespace.c new file mode 100644 index 0000000..fbef09e --- /dev/null +++ b/clang/test/Parser/c-namespace.c @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -fsyntax-only %s +void bla1() { + struct XXX; + int XXX; +} + diff --git a/clang/test/Parser/c1x-alignas.c b/clang/test/Parser/c1x-alignas.c new file mode 100644 index 0000000..5dccc99 --- /dev/null +++ b/clang/test/Parser/c1x-alignas.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s + +_Alignas(4) char c1; +unsigned _Alignas(long) char c2; +char _Alignas(16) c3; + +char c4 _Alignas(32); // expected-error {{expected ';' after top level declarator}} diff --git a/clang/test/Parser/c1x-generic-selection.c b/clang/test/Parser/c1x-generic-selection.c new file mode 100644 index 0000000..ee23059 --- /dev/null +++ b/clang/test/Parser/c1x-generic-selection.c @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -std=c1x -fsyntax-only -verify %s + +void foo(void) { + _Generic; // expected-error {{expected '('}} + (void) _Generic(0); // expected-error {{expected ','}} + (void) _Generic(0, void); // expected-error {{expected ':'}} + (void) _Generic(0, + default: 0, // expected-note {{previous default generic association is here}} + default: 0); // expected-error {{duplicate default generic association}} +} diff --git a/clang/test/Parser/char-literal-printing.c b/clang/test/Parser/char-literal-printing.c new file mode 100644 index 0000000..27dd63a --- /dev/null +++ b/clang/test/Parser/char-literal-printing.c @@ -0,0 +1,67 @@ +// RUN: %clang_cc1 -ast-print %s +// RUN: %clang_cc1 -x c++ -ast-print %s +// RUN: %clang_cc1 -x c++ -std=c++11 -ast-print %s + +#include + +char test1(void) { return '\\'; } +wchar_t test2(void) { return L'\\'; } +char test3(void) { return '\''; } +wchar_t test4(void) { return L'\''; } +char test5(void) { return '\a'; } +wchar_t test6(void) { return L'\a'; } +char test7(void) { return '\b'; } +wchar_t test8(void) { return L'\b'; } +char test9(void) { return '\e'; } +wchar_t test10(void) { return L'\e'; } +char test11(void) { return '\f'; } +wchar_t test12(void) { return L'\f'; } +char test13(void) { return '\n'; } +wchar_t test14(void) { return L'\n'; } +char test15(void) { return '\r'; } +wchar_t test16(void) { return L'\r'; } +char test17(void) { return '\t'; } +wchar_t test18(void) { return L'\t'; } +char test19(void) { return '\v'; } +wchar_t test20(void) { return L'\v'; } + +char test21(void) { return 'c'; } +wchar_t test22(void) { return L'c'; } +char test23(void) { return '\x3'; } +wchar_t test24(void) { return L'\x3'; } + +wchar_t test25(void) { return L'\x333'; } + +#if __cplusplus >= 201103L +char16_t test26(void) { return u'\\'; } +char16_t test27(void) { return u'\''; } +char16_t test28(void) { return u'\a'; } +char16_t test29(void) { return u'\b'; } +char16_t test30(void) { return u'\e'; } +char16_t test31(void) { return u'\f'; } +char16_t test32(void) { return u'\n'; } +char16_t test33(void) { return u'\r'; } +char16_t test34(void) { return u'\t'; } +char16_t test35(void) { return u'\v'; } + +char16_t test36(void) { return u'c'; } +char16_t test37(void) { return u'\x3'; } + +char16_t test38(void) { return u'\x333'; } + +char32_t test39(void) { return U'\\'; } +char32_t test40(void) { return U'\''; } +char32_t test41(void) { return U'\a'; } +char32_t test42(void) { return U'\b'; } +char32_t test43(void) { return U'\e'; } +char32_t test44(void) { return U'\f'; } +char32_t test45(void) { return U'\n'; } +char32_t test46(void) { return U'\r'; } +char32_t test47(void) { return U'\t'; } +char32_t test48(void) { return U'\v'; } + +char32_t test49(void) { return U'c'; } +char32_t test50(void) { return U'\x3'; } + +char32_t test51(void) { return U'\x333'; } +#endif diff --git a/clang/test/Parser/check-objc2-syntax-1.m b/clang/test/Parser/check-objc2-syntax-1.m new file mode 100644 index 0000000..3cdf2b0 --- /dev/null +++ b/clang/test/Parser/check-objc2-syntax-1.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +@interface Subclass ++ (int)magicNumber; +@end + +int main (void) { + return Subclass.magicNumber; +} + diff --git a/clang/test/Parser/check-syntax-1.m b/clang/test/Parser/check-syntax-1.m new file mode 100644 index 0000000..0ae0c5d --- /dev/null +++ b/clang/test/Parser/check-syntax-1.m @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +int @interface bla ; // expected-error {{cannot combine with previous 'int' declaration specifier}} +@end + +typedef float CGFloat; +@interface XNSNumber ++ (XNSNumber *) numberWithCGFloat : (CGFloat) float; // expected-error {{expected identifier}} \ + // expected-error {{expected ';' after method prototype}} +@end + +// rdar: // 7822196 +@interface A +(void) x; // expected-error {{method type specifier must start with '-' or '+'}} +(int)im; // expected-error {{method type specifier must start with '-' or '+'}} \ +- ok; +@end + + diff --git a/clang/test/Parser/check_cast.c b/clang/test/Parser/check_cast.c new file mode 100644 index 0000000..790ee40 --- /dev/null +++ b/clang/test/Parser/check_cast.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +struct foo { + int a; +}; + +int main() { + struct foo xxx; + int i; + + xxx = (struct foo)1; // expected-error {{used type 'struct foo' where arithmetic or pointer type is required}} + i = (int)xxx; // expected-error {{operand of type 'struct foo' where arithmetic or pointer type is required}} +} diff --git a/clang/test/Parser/compound_literal.c b/clang/test/Parser/compound_literal.c new file mode 100644 index 0000000..4f3609d --- /dev/null +++ b/clang/test/Parser/compound_literal.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +int main() { + char *s; + s = (char []){"whatever"}; +} diff --git a/clang/test/Parser/control-scope.c b/clang/test/Parser/control-scope.c new file mode 100644 index 0000000..5314980 --- /dev/null +++ b/clang/test/Parser/control-scope.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 %s -std=c90 -verify +// RUN: %clang_cc1 %s -std=c99 + +int f (int z) { + if (z + sizeof (enum {a})) // expected-note {{previous definition is here}} + return 1 + sizeof (enum {a}); // expected-error {{redefinition of enumerator 'a'}} + return 0; +} diff --git a/clang/test/Parser/cuda-kernel-call.cu b/clang/test/Parser/cuda-kernel-call.cu new file mode 100644 index 0000000..f95ae9e --- /dev/null +++ b/clang/test/Parser/cuda-kernel-call.cu @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +void foo(void) { + foo<<<1; // expected-error {{expected '>>>'}} expected-note {{to match this '<<<'}} + + foo<<<1,1>>>; // expected-error {{expected '('}} + + foo<<<>>>(); // expected-error {{expected expression}} +} diff --git a/clang/test/Parser/cxx-altivec.cpp b/clang/test/Parser/cxx-altivec.cpp new file mode 100644 index 0000000..9b2b1af --- /dev/null +++ b/clang/test/Parser/cxx-altivec.cpp @@ -0,0 +1,170 @@ +// RUN: %clang_cc1 -triple=powerpc-apple-darwin8 -faltivec -fsyntax-only -verify %s + +__vector char vv_c; +__vector signed char vv_sc; +__vector unsigned char vv_uc; +__vector short vv_s; +__vector signed short vv_ss; +__vector unsigned short vv_us; +__vector short int vv_si; +__vector signed short int vv_ssi; +__vector unsigned short int vv_usi; +__vector int vv_i; +__vector signed int vv_sint; +__vector unsigned int vv_ui; +__vector float vv_f; +__vector bool char vv_bc; +__vector bool short vv_bs; +__vector bool int vv_bi; +__vector __pixel vv_p; +__vector pixel vv__p; +__vector int vf__r(); +void vf__a(__vector int a); +void vf__a2(int b, __vector int a); + +vector char v_c; +vector signed char v_sc; +vector unsigned char v_uc; +vector short v_s; +vector signed short v_ss; +vector unsigned short v_us; +vector short int v_si; +vector signed short int v_ssi; +vector unsigned short int v_usi; +vector int v_i; +vector signed int v_sint; +vector unsigned int v_ui; +vector float v_f; +vector bool char v_bc; +vector bool short v_bs; +vector bool int v_bi; +vector __pixel v_p; +vector pixel v__p; +vector int f__r(); +void f_a(vector int a); +void f_a2(int b, vector int a); + +vector int v = (vector int)(-1); + +// These should have warnings. +__vector long vv_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long vv_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long vv_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long int vv_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector signed long int vv_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector unsigned long int vv_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long v_l; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long v_sl; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long v_ul; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector long int v_li; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector signed long int v_sli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +vector unsigned long int v_uli; // expected-warning {{Use of 'long' with '__vector' is deprecated}} +__vector long double vv_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} + +// These should have errors. +__vector double vv_d1; // expected-error {{cannot use 'double' with '__vector'}} +vector double v_d2; // expected-error {{cannot use 'double' with '__vector'}} +__vector long double vv_ld3; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector long double v_ld4; // expected-warning {{Use of 'long' with '__vector' is deprecated}} expected-error {{cannot use 'double' with '__vector'}} +vector bool v_b; // expected-error {{C++ requires a type specifier for all declarations}} +vector bool float v_bf; // expected-error {{cannot use 'float' with '__vector bool'}} +vector bool double v_bd; // expected-error {{cannot use 'double' with '__vector bool'}} +vector bool pixel v_bp; // expected-error {{cannot use '__pixel' with '__vector bool'}} +vector bool signed char v_bsc; // expected-error {{cannot use 'signed' with '__vector bool'}} +vector bool unsigned int v_bsc2; // expected-error {{cannot use 'unsigned' with '__vector bool'}} +vector bool long v_bl; // expected-error {{cannot use 'long' with '__vector bool'}} +vector bool long long v_bll; // expected-error {{cannot use 'long long' with '__vector bool'}} + +void f() { + __vector unsigned int v = {0,0,0,0}; + __vector int v__cast = (__vector int)v; + __vector int v_cast = (vector int)v; + __vector char vb_cast = (vector char)v; + + // Check some casting between gcc and altivec vectors. + #define gccvector __attribute__((vector_size(16))) + gccvector unsigned int gccv = {0,0,0,0}; + gccvector unsigned int gccv1 = gccv; + gccvector int gccv2 = (gccvector int)gccv; + gccvector unsigned int gccv3 = v; + __vector unsigned int av = gccv; + __vector int avi = (__vector int)gccv; + gccvector unsigned int gv = v; + gccvector int gvi = (gccvector int)v; + __attribute__((vector_size(8))) unsigned int gv8; + gv8 = gccv; // expected-error {{assigning to '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int' from incompatible type '__attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int'}} + av = gv8; // expected-error {{assigning to '__vector unsigned int' from incompatible type '__attribute__((__vector_size__(2 * sizeof(unsigned int)))) unsigned int'}} + + v = gccv; + __vector unsigned int tv = gccv; + gccv = v; + gccvector unsigned int tgv = v; +} + +// Now for the C++ version: + +class vc__v { + __vector int v; + __vector int f__r(); + void f__a(__vector int a); + void f__a2(int b, __vector int a); +}; + +class c_v { + vector int v; + vector int f__r(); + void f__a(vector int a); + void f__a2(int b, vector int a); +}; + + +// bug 6895 - Vectorl literal casting confusion. +vector char v1 = (vector char)((vector int)(1, 2, 3, 4)); +vector char v2 = (vector char)((vector float)(1.0f, 2.0f, 3.0f, 4.0f)); +vector char v3 = (vector char)((vector int)('a', 'b', 'c', 'd')); +vector int v4 = (vector int)(1, 2, 3, 4); +vector float v5 = (vector float)(1.0f, 2.0f, 3.0f, 4.0f); +vector char v6 = (vector char)((vector int)(1+2, -2, (int)(2.0 * 3), -(5-3))); + +// bug 7553 - Problem with '==' and vectors +void func() { + bool res_b; + res_b = (vv_sc == vv_sc); + res_b = (vv_uc != vv_uc); + res_b = (vv_s > vv_s); + res_b = (vv_us >= vv_us); + res_b = (vv_i < vv_i); + res_b = (vv_ui <= vv_ui); + res_b = (vv_f <= vv_f); +} + +// vecreturn attribute test +struct Vector +{ + __vector float xyzw; +} __attribute__((vecreturn)); + +Vector Add(Vector lhs, Vector rhs) +{ + Vector result; + result.xyzw = vec_add(lhs.xyzw, rhs.xyzw); + return result; // This will (eventually) be returned in a register +} + +// vecreturn attribute test - should error because of virtual function. +class VectorClassNonPod +{ + __vector float xyzw; +public: + VectorClassNonPod() {} + virtual ~VectorClassNonPod() {} +} __attribute__((vecreturn)); // expected-error {{the vecreturn attribute can only be used on a POD (plain old data) class or structure (i.e. no virtual functions)}} + +// vecreturn attribute test - should error because of virtual function. +class VectorClassMultipleMembers +{ +public: + __vector float xyzw; + __vector float abcd; +} __attribute__((vecreturn)); // expected-error {{the vecreturn attribute can only be used on a class or structure with one member, which must be a vector}} diff --git a/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp b/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp new file mode 100644 index 0000000..ac4accb --- /dev/null +++ b/clang/test/Parser/cxx-ambig-decl-expr-xfail.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// XFAIL: * +struct X { + template X(T); + X(int, int); + + X operator()(int, int) const; +}; + +template struct Y { }; + +X *x; +void f() { + int y = 0; + X (*x)(int(y), int(y)) = Y(), ++y; +} diff --git a/clang/test/Parser/cxx-ambig-decl-expr.cpp b/clang/test/Parser/cxx-ambig-decl-expr.cpp new file mode 100644 index 0000000..b5ff728 --- /dev/null +++ b/clang/test/Parser/cxx-ambig-decl-expr.cpp @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct X { + template + static void f(int, int); +}; + +void f() { + void (*ptr)(int, int) = &X::f; +} diff --git a/clang/test/Parser/cxx-ambig-paren-expr.cpp b/clang/test/Parser/cxx-ambig-paren-expr.cpp new file mode 100644 index 0000000..3988205 --- /dev/null +++ b/clang/test/Parser/cxx-ambig-paren-expr.cpp @@ -0,0 +1,66 @@ +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s + +void f() { + typedef int T; + int x, *px; + + // Type id. + (T())x; // expected-error {{cast from 'int' to 'T ()'}} + (T())+x; // expected-error {{cast from 'int' to 'T ()'}} + (T())*px; // expected-error {{cast from 'int' to 'T ()'}} + + // Expression. + x = (T()); + x = (T())/x; + + typedef int *PT; + // Make sure stuff inside the parens are parsed only once (only one warning). + x = (PT()[(int){1}]); // expected-warning {{compound literals}} + + // Special case: empty parens is a call, not an expression + struct S{int operator()();}; + (S())(); + + // FIXME: Special case: "++" is postfix here, not prefix + // (S())++; +} + +// Make sure we do tentative parsing correctly in conditions. +typedef int type; +struct rec { rec(int); }; + +namespace ns { + typedef int type; + struct rec { rec(int); }; +} + +struct cls { + typedef int type; + struct rec { rec(int); }; +}; + +struct result { + template result(T); + bool check(); +}; + +void test(int i) { + if (result((cls::type) i).check()) + return; + + if (result((ns::type) i).check()) + return; + + if (result((::type) i).check()) + return; + + if (result((cls::rec) i).check()) + return; + + if (result((ns::rec) i).check()) + return; + + if (result((::rec) i).check()) + return; +} + diff --git a/clang/test/Parser/cxx-attributes.cpp b/clang/test/Parser/cxx-attributes.cpp new file mode 100644 index 0000000..8603b30 --- /dev/null +++ b/clang/test/Parser/cxx-attributes.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -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/clang/test/Parser/cxx-bool.cpp b/clang/test/Parser/cxx-bool.cpp new file mode 100644 index 0000000..a8a161e --- /dev/null +++ b/clang/test/Parser/cxx-bool.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -fsyntax-only %s + +bool a = true; +bool b = false; diff --git a/clang/test/Parser/cxx-casting.cpp b/clang/test/Parser/cxx-casting.cpp new file mode 100644 index 0000000..42ad12e --- /dev/null +++ b/clang/test/Parser/cxx-casting.cpp @@ -0,0 +1,92 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +char *const_cast_test(const char *var) +{ + return const_cast(var); +} + +struct A { + virtual ~A() {} +}; + +struct B : public A { +}; + +struct B *dynamic_cast_test(struct A *a) +{ + return dynamic_cast(a); +} + +char *reinterpret_cast_test() +{ + return reinterpret_cast(0xdeadbeef); +} + +double static_cast_test(int i) +{ + return static_cast(i); +} + +char postfix_expr_test() +{ + return reinterpret_cast(0xdeadbeef)[0]; +} + +// This was being incorrectly tentatively parsed. +namespace test1 { + template class A {}; // expected-note 2{{here}} + void foo() { A(*(A*)0); } +} + +typedef char* c; +typedef A* a; +void test2(char x, struct B * b) { + (void)const_cast<::c>(&x); // expected-error{{found '<::' after a const_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + (void)dynamic_cast<::a>(b); // expected-error{{found '<::' after a dynamic_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + (void)reinterpret_cast<::c>(x); // expected-error{{found '<::' after a reinterpret_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + (void)static_cast<::c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + + // Do not do digraph correction. + (void)static_cast<: :c>(&x); //\ + expected-error {{expected '<' after 'static_cast'}} \ + expected-error {{expected expression}}\ + expected-error {{expected ']'}}\ + expected-note {{to match this '['}} + (void)static_cast<: // expected-error {{expected '<' after 'static_cast'}} \ + expected-note {{to match this '['}} + :c>(&x); // expected-error {{expected expression}} \ + expected-error {{expected ']'}} +#define LC <: +#define C : + test1::A LC:B> c; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}} + (void)static_cast LC:c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}} + test1::A<:C B> d; // expected-error {{cannot refer to class template 'A' without a template argument list}} expected-error 2{{}} expected-note{{}} + (void)static_cast<:C c>(&x); // expected-error {{expected '<' after 'static_cast'}} expected-error 2{{}} expected-note{{}} + +#define LCC <:: + test1::A LCC B> e; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + (void)static_cast LCC c>(&x); // expected-error{{found '<::' after a static_cast which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} +} + + // This note comes from "::D[:F> A5;" +template class D {}; // expected-note{{template is declared here}} +template void E() {}; +class F {}; + +void test3() { + ::D<::F> A1; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + D<::F> A2; // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + ::E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + E<::F>(); // expected-error{{found '<::' after a template name which forms the digraph '<:' (aka '[') and a ':', did you mean '< ::'?}} + + ::D< ::F> A3; + D< ::F> A4; + ::E< ::F>(); + E< ::F>(); + + // Make sure that parser doesn't expand '[:' to '< ::' + ::D[:F> A5; // expected-error {{cannot refer to class template 'D' without a template argument list}} \ + // expected-error {{expected expression}} \ + // expected-error {{expected ']'}} \ + // expected-note {{to match this '['}} +} diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp new file mode 100644 index 0000000..1b3dd41 --- /dev/null +++ b/clang/test/Parser/cxx-class.cpp @@ -0,0 +1,89 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s +class C; +class C { +public: +protected: + typedef int A,B; + static int sf(), u; + + struct S {}; + enum {}; // expected-warning{{declaration does not declare anything}} + int; // expected-warning {{declaration does not declare anything}} + int : 1, : 2; + +public: + void m() { + int l = 2; + }; + + template void mt(T) { }; + ; // expected-warning{{extra ';' inside a class}} + + virtual int vf() const volatile = 0; + +private: + int x,f(),y,g(); + inline int h(); + static const int sci = 10; + mutable int mi; +}; +void glo() +{ + struct local {}; +} + +// PR3177 +typedef union { + __extension__ union { + int a; + float b; + } y; +} bug3177; + +// check that we don't consume the token after the access specifier +// when it's not a colon +class D { +public // expected-error{{expected ':'}} + int i; +}; + +// consume the token after the access specifier if it's a semicolon +// that was meant to be a colon +class E { +public; // expected-error{{expected ':'}} + int i; +}; + +class F { + int F1 { return 1; } // expected-error{{function definition does not declare parameters}} + void F2 {} // expected-error{{function definition does not declare parameters}} + typedef int F3() { return 0; } // expected-error{{function definition declared 'typedef'}} + typedef void F4() {} // expected-error{{function definition declared 'typedef'}} +}; + +namespace ctor_error { + class Foo {}; + // By [class.qual]p2, this is a constructor declaration. + Foo::Foo (F) = F(); // expected-error{{does not match any declaration in 'ctor_error::Foo'}} + + class Ctor { // expected-note{{not complete until the closing '}'}} + Ctor(f)(int); // ok + Ctor(g(int)); // ok + Ctor(x[5]); // expected-error{{incomplete type}} + + Ctor(UnknownType *); // expected-error{{unknown type name 'UnknownType'}} + void operator+(UnknownType*); // expected-error{{unknown type name 'UnknownType'}} + }; + + Ctor::Ctor (x) = { 0 }; // \ + // expected-error{{qualified reference to 'Ctor' is a constructor name}} + + Ctor::Ctor(UnknownType *) {} // \ + // expected-error{{unknown type name 'UnknownType'}} + void Ctor::operator+(UnknownType*) {} // \ + // expected-error{{unknown type name 'UnknownType'}} +} + +// PR11109 must appear at the end of the source file +class pr11109r3 { // expected-note{{to match this '{'}} + public // expected-error{{expected ':'}} expected-error{{expected '}'}} expected-error{{expected ';' after class}} diff --git a/clang/test/Parser/cxx-condition.cpp b/clang/test/Parser/cxx-condition.cpp new file mode 100644 index 0000000..5672eea --- /dev/null +++ b/clang/test/Parser/cxx-condition.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct S { S(int); operator bool(); }; + +void f() { + int a; + while (a) ; + while (int x) ; // expected-error {{variable declaration in condition must have an initializer}} + while (float x = 0) ; + if (const int x = a) ; // expected-warning{{empty body}} expected-note{{put the semicolon on a separate line to silence this warning}} + switch (int x = a+10) {} + for (; int x = ++a; ) ; + + if (S a(42)) {} // expected-error {{variable declaration in condition cannot have a parenthesized initializer}} +} diff --git a/clang/test/Parser/cxx-decl.cpp b/clang/test/Parser/cxx-decl.cpp new file mode 100644 index 0000000..57f33d8 --- /dev/null +++ b/clang/test/Parser/cxx-decl.cpp @@ -0,0 +1,129 @@ +// RUN: %clang_cc1 -verify -fsyntax-only -triple i386-linux %s + +int x(*g); // expected-error {{use of undeclared identifier 'g'}} + +struct Type { + int Type; +}; + +// rdar://8365458 +// rdar://9132143 +typedef char bool; // expected-error {{redeclaration of C++ built-in type 'bool'}} + +// 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 +class someclass { + + int bar() { + T *P; + return 1 ? P->x : P->y; + } +}; + +class asm_class_test { + void foo() __asm__("baz"); +}; + +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; +} + +struct test4 { + int x // expected-error {{expected ';' at end of declaration list}} + int y; + int z // expected-error {{expected ';' at end of declaration list}} +}; + +// Make sure we know these are legitimate commas and not typos for ';'. +namespace Commas { + struct S { + static int a; + int c, + operator()(); + }; + + int global1, + __attribute__(()) global2, + (global5), + *global6, + &global7 = global1, + &&global8 = static_cast(global1), // expected-warning 2{{rvalue reference}} + S::a, + global9, + global10 = 0, + global11 == 0, // expected-error {{did you mean '='}} + global12 __attribute__(()), + global13(0), + global14[2], + global15; + + void g() { + static int a, + b __asm__("ebx"), // expected-error {{expected ';' at end of declaration}} + Statics:return; + } +} + +// PR5825 +struct test5 {}; +::new(static_cast(0)) test5; // expected-error {{expected unqualified-id}} + + +// PR6782 +template +class Class1; + +class Class2 { +} // no ; + +typedef Class1 Type1; // expected-error {{cannot combine with previous 'class' declaration specifier}} + +// rdar : // 8307865 +struct CodeCompleteConsumer { +}; + +void CodeCompleteConsumer::() { // expected-error {{xpected unqualified-id}} +} + +; + +// PR8380 +extern "" // expected-error {{unknown linkage language}} +test6a { ;// expected-error {{C++ requires a type specifier for all declarations}} \ + // expected-error {{expected ';' after top level declarator}} + + int test6b; + + diff --git a/clang/test/Parser/cxx-default-args.cpp b/clang/test/Parser/cxx-default-args.cpp new file mode 100644 index 0000000..7fe8474 --- /dev/null +++ b/clang/test/Parser/cxx-default-args.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR6647 +class C { + // After the error, the rest of the tokens inside the default arg should be + // skipped, avoiding a "expected ';' after class" after 'undecl'. + void m(int x = undecl + 0); // expected-error {{use of undeclared identifier 'undecl'}} +}; + +typedef struct Inst { + void m(int x=0); +} *InstPtr; + +struct X { + void f(int x = 1:); // expected-error {{unexpected end of default argument expression}} +}; diff --git a/clang/test/Parser/cxx-default-delete.cpp b/clang/test/Parser/cxx-default-delete.cpp new file mode 100644 index 0000000..df24b3d --- /dev/null +++ b/clang/test/Parser/cxx-default-delete.cpp @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +int i = delete; // expected-error{{only functions}} +int j = default; // expected-error{{special member functions}} + +int f() = delete, g; // expected-error{{'= delete' is a function definition}} +int o, p() = delete; // expected-error{{'= delete' is a function definition}} + +int q() = default, r; // expected-error{{only special member functions}} \ + // expected-error{{'= default' is a function definition}} +int s, t() = default; // expected-error{{'= default' is a function definition}} + +struct foo { + foo() = default; + ~foo() = delete; + void bar() = delete; +}; + +void baz() = delete; + +struct quux { + int quux() = default; // expected-error{{constructor cannot have a return type}} expected-error {{member 'quux' has the same name as its class}} +}; diff --git a/clang/test/Parser/cxx-ext-delete-default.cpp b/clang/test/Parser/cxx-ext-delete-default.cpp new file mode 100644 index 0000000..af8b6d6 --- /dev/null +++ b/clang/test/Parser/cxx-ext-delete-default.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s + +struct A { + A(const A&) = delete; // expected-warning {{C++11 extension}} + A& operator=(const A&) = delete; // expected-warning {{C++11 extension}} + A() = default; // expected-warning {{C++11 extension}} + ~A(); +}; + +void f() = delete; // expected-warning {{C++11 extension}} +A::~A() = default; //expected-warning {{C++11 extension}} diff --git a/clang/test/Parser/cxx-extern-c-array.cpp b/clang/test/Parser/cxx-extern-c-array.cpp new file mode 100644 index 0000000..14912fd --- /dev/null +++ b/clang/test/Parser/cxx-extern-c-array.cpp @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +extern "C" int myarray[]; +int myarray[12] = {0}; + +extern "C" int anotherarray[][3]; +int anotherarray[2][3] = {1,2,3,4,5,6}; diff --git a/clang/test/Parser/cxx-friend.cpp b/clang/test/Parser/cxx-friend.cpp new file mode 100644 index 0000000..a13e7ba --- /dev/null +++ b/clang/test/Parser/cxx-friend.cpp @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +class C { + friend class D; +}; + +class A { +public: + void f(); +}; + +friend int x; // expected-error {{'friend' used outside of class}} + +friend class D {}; // expected-error {{'friend' used outside of class}} + +union U { + int u1; +}; + +class B { + // 'A' here should refer to the declaration above. + friend class A; + + friend C; // expected-warning {{specify 'class' to befriend}} + friend U; // expected-warning {{specify 'union' to befriend}} + friend int; // expected-warning {{non-class friend type 'int'}} + + friend void myfunc(); + + void f(A *a) { a->f(); } +}; + + + + + +template class some_template; +friend // expected-error {{'friend' used outside of class}} +some_template& // expected-error {{use of undeclared identifier 'foo'}} + ; // expected-error {{expected unqualified-id}} diff --git a/clang/test/Parser/cxx-in-c.c b/clang/test/Parser/cxx-in-c.c new file mode 100644 index 0000000..f5fa39b --- /dev/null +++ b/clang/test/Parser/cxx-in-c.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +// PR9137 +void f0(int x) : {}; // expected-error{{expected function body after function declarator}} +void f1(int x) try {}; // expected-error{{expected function body after function declarator}} diff --git a/clang/test/Parser/cxx-member-crash.cpp b/clang/test/Parser/cxx-member-crash.cpp new file mode 100644 index 0000000..2b31a60 --- /dev/null +++ b/clang/test/Parser/cxx-member-crash.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only %s 2>&1|FileCheck %s + +// + +// We only care to chek whether the compiler crashes; the actual +// diagnostics are uninteresting. +// CHECK: 8 errors generated. +template struct char_traits; +template > class basic_ios; +template > class ostreambuf_iterator; +template > class num_get; +template class basic_ostream : virtual public basic_ios<_CharT, _Traits> { + template _InIter num_get<_CharT, _InIter>:: _M_extract_float(_InIter __beg, _InIter __end, ios_base& __io, ios_base::iostate& __err, string& __xtrc) const { + const bool __plus = __c == __lit[__num_base::_S_iplus]; + if ((__plus || __c == __lit[__num_base::_S_iminus]) && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep) && !(__c == __lc->_M_decimal_point)) { diff --git a/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp b/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp new file mode 100644 index 0000000..5485e7d --- /dev/null +++ b/clang/test/Parser/cxx-member-init-missing-paren-crash.cpp @@ -0,0 +1,12 @@ +// RUN: not %clang_cc1 -fsyntax-only %s +// Note: The important part here is that we don't crash, not any specific errors +class Test { + public: + Test() : ab_(false {}; + + bool ab() { + return ab_; + } + private: + bool ab_; +} diff --git a/clang/test/Parser/cxx-member-initializers.cpp b/clang/test/Parser/cxx-member-initializers.cpp new file mode 100644 index 0000000..5c39068 --- /dev/null +++ b/clang/test/Parser/cxx-member-initializers.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +struct x { + x() : a(4) ; // expected-error {{expected '{'}} +}; + +struct y { + int a; + y() : a(4) ; // expected-error {{expected '{'}} +}; + +struct z { + int a; + z() : a {} // expected-error {{expected '('}} +}; diff --git a/clang/test/Parser/cxx-namespace-alias.cpp b/clang/test/Parser/cxx-namespace-alias.cpp new file mode 100644 index 0000000..9b90aab --- /dev/null +++ b/clang/test/Parser/cxx-namespace-alias.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +namespace A = B; // expected-error{{namespace name}} + +namespace A = !; // expected-error {{expected namespace name}} +namespace A = A::!; // expected-error {{expected namespace name}} \ + // expected-error{{use of undeclared identifier 'A'}} + + diff --git a/clang/test/Parser/cxx-reference.cpp b/clang/test/Parser/cxx-reference.cpp new file mode 100644 index 0000000..d21412c --- /dev/null +++ b/clang/test/Parser/cxx-reference.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +extern char *bork; +char *& bar = bork; + +int val; + +void foo(int &a) { +} + +typedef int & A; + +void g(const A aref) { +} + +int & const X = val; // expected-error {{'const' qualifier may not be applied to a reference}} +int & volatile Y = val; // expected-error {{'volatile' qualifier may not be applied to a reference}} +int & const volatile Z = val; /* expected-error {{'const' qualifier may not be applied}} \ + expected-error {{'volatile' qualifier may not be applied}} */ + +typedef int && RV; // expected-warning {{rvalue references are a C++11 extension}} diff --git a/clang/test/Parser/cxx-stmt.cpp b/clang/test/Parser/cxx-stmt.cpp new file mode 100644 index 0000000..7677ca8 --- /dev/null +++ b/clang/test/Parser/cxx-stmt.cpp @@ -0,0 +1,60 @@ +// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s + +void f1() +{ + try { + ; + } catch(int i) { + ; + } catch(...) { + } +} + +void f2() +{ + try; // expected-error {{expected '{'}} + + try {} + catch; // expected-error {{expected '('}} + + try {} + catch (...); // expected-error {{expected '{'}} + + try {} + catch {} // expected-error {{expected '('}} +} + +void f3() try { +} catch(...) { +} + +struct A { + int i; + A(int); + A(char); + A() try : i(0) {} catch(...) {} + void f() try {} catch(...) {} + A(float) : i(0) try {} // expected-error {{expected '{' or ','}} +}; + +A::A(char) : i(0) try {} // expected-error {{expected '{' or ','}} +A::A(int j) try : i(j) {} catch(...) {} + + + +// PR5740 +struct Type { }; + +enum { Type } Kind; +void f4() { + int i = 0; + switch (Kind) { + case Type: i = 7; break; // no error. + } +} + +// PR5500 +void f5() { + asm volatile ("":: :"memory"); + asm volatile ("": ::"memory"); +} diff --git a/clang/test/Parser/cxx-template-argument.cpp b/clang/test/Parser/cxx-template-argument.cpp new file mode 100644 index 0000000..c85b1c9 --- /dev/null +++ b/clang/test/Parser/cxx-template-argument.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template struct A {}; + +// Check for template argument lists followed by junk +// FIXME: The diagnostics here aren't great... +A int x; // expected-error {{expected '>'}} expected-error {{expected unqualified-id}} +A'}} + +// PR8912 +template struct S {}; +S 1)> s; diff --git a/clang/test/Parser/cxx-template-decl.cpp b/clang/test/Parser/cxx-template-decl.cpp new file mode 100644 index 0000000..7e931a3 --- /dev/null +++ b/clang/test/Parser/cxx-template-decl.cpp @@ -0,0 +1,115 @@ +// RUN: %clang_cc1 -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 x0; // expected-warning {{exported templates are unsupported}} +template < ; // expected-error {{expected template parameter}} \ +// expected-error{{expected ',' or '>' in template-parameter-list}} \ +// expected-warning {{declaration does not declare anything}} +template struct x1; // expected-error {{expected ',' or '>' in template-parameter-list}} + +// verifies that we only walk to the ',' & still produce errors on the rest of the template parameters +template struct x2; // expected-error {{expected ',' or '>' in template-parameter-list}} \ + expected-error {{expected unqualified-id}} +template> struct x3; // expected-error {{expected ',' or '>' in template-parameter-list}} \ + expected-error {{template template parameter requires 'class' after the parameter list}} +template