diff options
Diffstat (limited to 'test/SemaCXX')
-rw-r--r-- | test/SemaCXX/MicrosoftCompatibility-cxx98.cpp | 23 | ||||
-rw-r--r-- | test/SemaCXX/MicrosoftCompatibility.cpp | 24 | ||||
-rw-r--r-- | test/SemaCXX/MicrosoftExtensions.cpp | 8 | ||||
-rw-r--r-- | test/SemaCXX/modules-ts.cppm | 15 |
4 files changed, 39 insertions, 31 deletions
diff --git a/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp b/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp deleted file mode 100644 index 3b80d0937e231..0000000000000 --- a/test/SemaCXX/MicrosoftCompatibility-cxx98.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++98 -Wmicrosoft -verify -fms-compatibility -fexceptions -fcxx-exceptions - - -//MSVC allows forward enum declaration -enum ENUM; // expected-warning {{forward references to 'enum' types are a Microsoft extension}} -ENUM *var = 0; -ENUM var2 = (ENUM)3; -enum ENUM1* var3 = 0;// expected-warning {{forward references to 'enum' types are a Microsoft extension}} - -typedef void (*FnPtrTy)(); -void (*PR23733_1)() = static_cast<FnPtrTy>((void *)0); // expected-warning {{static_cast between pointer-to-function and pointer-to-object is a Microsoft extension}} -void (*PR23733_2)() = FnPtrTy((void *)0); -void (*PR23733_3)() = (FnPtrTy)((void *)0); -void (*PR23733_4)() = reinterpret_cast<FnPtrTy>((void *)0); - -long function_prototype(int a); -long (*function_ptr)(int a); - -void function_to_voidptr_conv() { - void *a1 = function_prototype; // expected-warning {{implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension}} - void *a2 = &function_prototype; // expected-warning {{implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension}} - void *a3 = function_ptr; // expected-warning {{implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension}} -} diff --git a/test/SemaCXX/MicrosoftCompatibility.cpp b/test/SemaCXX/MicrosoftCompatibility.cpp index 26cd7825ee87a..d095f6edc6179 100644 --- a/test/SemaCXX/MicrosoftCompatibility.cpp +++ b/test/SemaCXX/MicrosoftCompatibility.cpp @@ -224,6 +224,15 @@ template void function_missing_typename<D>(const D::Type param); } +//MSVC allows forward enum declaration +enum ENUM; // expected-warning {{forward references to 'enum' types are a Microsoft extension}} +ENUM *var = 0; +ENUM var2 = (ENUM)3; +enum ENUM1* var3 = 0;// expected-warning {{forward references to 'enum' types are a Microsoft extension}} + +enum ENUM1 { kA }; +enum ENUM1; // This way round is fine. + enum ENUM2 { ENUM2_a = (enum ENUM2) 4, ENUM2_b = 0x9FFFFFFF, // expected-warning {{enumerator value is not representable in the underlying type 'int'}} @@ -269,3 +278,18 @@ void g() { f(0xffffffffffffffffi64); } } + +typedef void (*FnPtrTy)(); +void (*PR23733_1)() = static_cast<FnPtrTy>((void *)0); // expected-warning {{static_cast between pointer-to-function and pointer-to-object is a Microsoft extension}} +void (*PR23733_2)() = FnPtrTy((void *)0); +void (*PR23733_3)() = (FnPtrTy)((void *)0); +void (*PR23733_4)() = reinterpret_cast<FnPtrTy>((void *)0); + +long function_prototype(int a); +long (*function_ptr)(int a); + +void function_to_voidptr_conv() { + void *a1 = function_prototype; // expected-warning {{implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension}} + void *a2 = &function_prototype; // expected-warning {{implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension}} + void *a3 = function_ptr; // expected-warning {{implicit conversion between pointer-to-function and pointer-to-object is a Microsoft extension}} +} diff --git a/test/SemaCXX/MicrosoftExtensions.cpp b/test/SemaCXX/MicrosoftExtensions.cpp index 96088a084558a..38949e11376d5 100644 --- a/test/SemaCXX/MicrosoftExtensions.cpp +++ b/test/SemaCXX/MicrosoftExtensions.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -std=c++98 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 // RUN: %clang_cc1 -std=c++11 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1 // RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2 +// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++11 -fms-compatibility -verify -DTEST3 #if TEST1 @@ -508,6 +509,13 @@ int S::fn() { return 0; } // expected-warning {{is missing exception specificati // Check that __unaligned is not recognized if MS extensions are not enabled typedef char __unaligned *aligned_type; // expected-error {{expected ';' after top level declarator}} +#elif TEST3 + +namespace PR32750 { +template<typename T> struct A {}; +template<typename T> struct B : A<A<T>> { A<T>::C::D d; }; // expected-error {{missing 'typename' prior to dependent type name 'A<T>::C::D'}} +} + #else #error Unknown test mode diff --git a/test/SemaCXX/modules-ts.cppm b/test/SemaCXX/modules-ts.cppm index 71c09d3bfe6cb..16695f6463a82 100644 --- a/test/SemaCXX/modules-ts.cppm +++ b/test/SemaCXX/modules-ts.cppm @@ -1,22 +1,21 @@ // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -DTEST=0 -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -Dmodule=int -DTEST=1 -// RUN: not %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -DTEST=2 2>&1 | FileCheck %s --check-prefix=CHECK-2 +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -DTEST=1 +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -verify -DTEST=2 // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -verify -Dfoo=bar -DTEST=3 #if TEST == 0 // expected-no-diagnostics #endif -module foo; -#if TEST == 1 -// expected-error@-2 {{expected module declaration at start of module interface}} -#elif TEST == 2 -// CHECK-2: error: redefinition of module 'foo' +export module foo; +#if TEST == 2 +// expected-error@-2 {{redefinition of module 'foo'}} +// expected-note@modules-ts.cppm:* {{loaded from}} #endif static int m; // ok, internal linkage, so no redefinition error int n; -#if TEST == 3 +#if TEST >= 2 // expected-error@-2 {{redefinition of '}} // expected-note@-3 {{previous}} #endif |