Fix a pair of tests that would fail on a win32 box

The tests don't specify a triple in some cases, since they shouldn't be
necessary, so I've updated the tests to detect via macro when they are
running on win32 to give the slightly altered diagnostic.
This commit is contained in:
Erich Keane 2020-11-17 14:28:52 -08:00
parent b2613fb2f0
commit a72f11ee20
2 changed files with 28 additions and 10 deletions

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify=expected,nowin32
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify=expected,win32 -triple i386-windows
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify -triple i386-windows
void defargs() {
auto l1 = [](int i, int j = 17, int k = 18) { return i + j + k; };
@ -44,9 +44,12 @@ template void defargs_in_template_unused(NoDefaultCtor); // expected-note{{in i
template<typename T>
void defargs_in_template_used() {
auto l1 = [](const T& value = T()) { }; // expected-error{{no matching constructor for initialization of 'NoDefaultCtor'}} \
// expected-note{{candidate function not viable: requires single argument 'value', but no arguments were provided}} \
// nowin32-note{{conversion candidate of type 'void (*)(const NoDefaultCtor &)'}}\
// win32-note{{conversion candidate of type 'void (*)(const NoDefaultCtor &) __attribute__((thiscall))'}}
// expected-note{{candidate function not viable: requires single argument 'value', but no arguments were provided}}
#if defined(_WIN32) && !defined(_WIN64)
// expected-note@46{{conversion candidate of type 'void (*)(const NoDefaultCtor &) __attribute__((thiscall))'}}
#else
// expected-note@46{{conversion candidate of type 'void (*)(const NoDefaultCtor &)'}}
#endif
l1(); // expected-error{{no matching function for call to object of type '(lambda at }}
}

View File

@ -1,5 +1,5 @@
//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify=expected,nowin32 | FileCheck %s
//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify=expected,win32 -triple i386-windows | FileCheck %s
//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify | FileCheck %s
//RUN: %clang_cc1 %s -cl-std=clc++ -pedantic -ast-dump -verify -triple i386-windows | FileCheck %s
//CHECK: CXXMethodDecl {{.*}} constexpr operator() 'int (__private int){{.*}} const __generic'
auto glambda = [](auto a) { return a; };
@ -32,12 +32,27 @@ __kernel void test_qual() {
//CHECK: |-CXXMethodDecl {{.*}} constexpr operator() 'void () {{.*}}const __generic'
auto priv2 = []() __generic {};
priv2();
auto priv3 = []() __global {}; //expected-note{{candidate function not viable: 'this' object is in address space '__private', but method expects object in address space '__global'}} //nowin32-note{{conversion candidate of type 'void (*)()'}}//win32-note{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
auto priv3 = []() __global {}; //expected-note{{candidate function not viable: 'this' object is in address space '__private', but method expects object in address space '__global'}}
#if defined(_WIN32) && !defined(_WIN64)
//expected-note@35{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
#else
//expected-note@35{{conversion candidate of type 'void (*)()'}}
#endif
priv3(); //expected-error{{no matching function for call to object of type}}
__constant auto const1 = []() __private{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__private'}} //nowin32-note{{conversion candidate of type 'void (*)()'}} //win32-note{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
__constant auto const1 = []() __private{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__private'}}
#if defined(_WIN32) && !defined(_WIN64)
//expected-note@43{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
#else
//expected-note@43{{conversion candidate of type 'void (*)()'}}
#endif
const1(); //expected-error{{no matching function for call to object of type '__constant (lambda at}}
__constant auto const2 = []() __generic{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__generic'}} //nowin32-note{{conversion candidate of type 'void (*)()'}} //win32-note{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
__constant auto const2 = []() __generic{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__generic'}}
#if defined(_WIN32) && !defined(_WIN64)
//expected-note@50{{conversion candidate of type 'void (*)() __attribute__((thiscall))'}}
#else
//expected-note@50{{conversion candidate of type 'void (*)()'}}
#endif
const2(); //expected-error{{no matching function for call to object of type '__constant (lambda at}}
//CHECK: |-CXXMethodDecl {{.*}} constexpr operator() 'void () {{.*}}const __constant'
__constant auto const3 = []() __constant{};