blob: 0a23788ef3da6aca538454d154bc65926517aafa [file] [log] [blame]
David Blaikie5e328052019-05-03 00:44:50 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3enum copy_traits { movable = 1 };
4
5template <int>
6struct optional_ctor_base {};
7template <typename T>
8struct 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;
13};
14template <typename T>
15struct optional : optional_ctor_base<ctor_copy_traits<T>::traits> {
16 template <typename U>
17 constexpr optional(U&& v);
18};
19struct A {};
20struct XA {
21 XA(const A&);
22};
23struct B {};
24struct XB {
25 XB(const B&);
26 XB(const optional<B>&);
27};
28struct YB : XB {
29 using XB::XB;
30};
31void InsertRow(const XA&, const YB&); // expected-note {{candidate function not viable: no known conversion from 'int' to 'const XA' for 1st argument}}
32void ReproducesBugSimply() {
33 InsertRow(3, B{}); // expected-error {{no matching function for call to 'InsertRow'}}
34}
35