[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / overload-template.cpp
blob0a23788ef3da6aca538454d154bc65926517aafa
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 enum copy_traits { movable = 1 };
5 template <int>
6 struct optional_ctor_base {};
7 template <typename T>
8 struct ctor_copy_traits {
9 // this would produce a c++98-compat warning, which would erroneously get the
10 // no-matching-function-call error's notes attached to it (or suppress those
11 // notes if this diagnostic was suppressed, as it is in this case)
12 static constexpr int traits = copy_traits::movable;
14 template <typename T>
15 struct optional : optional_ctor_base<ctor_copy_traits<T>::traits> {
16 template <typename U>
17 constexpr optional(U&& v);
19 struct A {};
20 struct XA {
21 XA(const A&);
23 struct B {};
24 struct XB {
25 XB(const B&);
26 XB(const optional<B>&);
28 struct YB : XB {
29 using XB::XB;
31 void InsertRow(const XA&, const YB&); // expected-note {{candidate function not viable: no known conversion from 'int' to 'const XA' for 1st argument}}
32 void ReproducesBugSimply() {
33 InsertRow(3, B{}); // expected-error {{no matching function for call to 'InsertRow'}}