Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / cxx2a-explicit-bool-deferred.cpp
blob4d667008f2e2763b2b68457f3c214f6045be292a
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++2a %s
3 template <typename T1, typename T2> struct is_same {
4 static constexpr bool value = false;
5 };
7 template <typename T> struct is_same<T, T> {
8 static constexpr bool value = true;
9 };
11 template <class T, class U>
12 concept SameHelper = is_same<T, U>::value;
13 template <class T, class U>
14 concept same_as = SameHelper<T, U> && SameHelper<U, T>;
16 namespace deferred_instantiation {
17 template <class X> constexpr X do_not_instantiate() { return nullptr; }
19 struct T {
20 template <same_as<float> X> explicit(do_not_instantiate<X>()) T(X) {}
22 T(int) {}
25 T t(5);
26 // expected-error@17{{cannot initialize}}
27 // expected-note@20{{in instantiation of function template specialization}}
28 // expected-note@30{{while substituting deduced template arguments}}
29 // expected-note@30{{in instantiation of function template specialization}}
30 T t2(5.0f);
31 } // namespace deferred_instantiation