[lld][WebAssembly] Reinstate mistakenly disabled test. NFC
[llvm-project.git] / clang / test / SemaCXX / default-arg-closures.cpp
blob676bd486105f935d4ce08b9067995a32ed4e0b8d
1 // RUN: %clang_cc1 -triple x86_64-windows-msvc -fexceptions -fcxx-exceptions -fms-extensions -verify %s -std=c++11
3 // The MS ABI has a few ways to generate constructor closures, which require
4 // instantiating and checking the semantics of default arguments. Make sure we
5 // do that right.
7 template <typename T>
8 struct DependentDefaultCtorArg {
9 // expected-error@+1 {{type 'int' cannot be used prior to '::' because it has no members}}
10 DependentDefaultCtorArg(int n = T::error);
12 struct
13 __declspec(dllexport) // expected-note {{due to 'ExportDefaultCtorClosure' being dllexported}}
14 ExportDefaultCtorClosure // expected-note {{in instantiation of default function argument expression for 'DependentDefaultCtorArg<int>' required here}} expected-note {{implicit default constructor for 'ExportDefaultCtorClosure' first required here}}
15 : DependentDefaultCtorArg<int>
16 {};
18 template <typename T>
19 struct DependentDefaultCopyArg {
20 DependentDefaultCopyArg() {}
21 // expected-error@+1 {{type 'int' cannot be used prior to '::' because it has no members}}
22 DependentDefaultCopyArg(const DependentDefaultCopyArg &o, int n = T::member) {}
25 struct HasMember {
26 enum { member = 0 };
28 void UseDependentArg() { throw DependentDefaultCopyArg<HasMember>(); }
30 void ErrorInDependentArg() {
31 throw DependentDefaultCopyArg<int>(); // expected-note {{required here}}
34 struct HasCleanup {
35 ~HasCleanup();
38 struct Default {
39 Default(const Default &o, int d = (HasCleanup(), 42));
42 void f(const Default &d) {
43 throw d;