David Blaikie | 5e32805 | 2019-05-03 00:44:50 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | enum copy_traits { movable = 1 }; |
| 4 | |
| 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; |
| 13 | }; |
| 14 | template <typename T> |
| 15 | struct optional : optional_ctor_base<ctor_copy_traits<T>::traits> { |
| 16 | template <typename U> |
| 17 | constexpr optional(U&& v); |
| 18 | }; |
| 19 | struct A {}; |
| 20 | struct XA { |
| 21 | XA(const A&); |
| 22 | }; |
| 23 | struct B {}; |
| 24 | struct XB { |
| 25 | XB(const B&); |
| 26 | XB(const optional<B>&); |
| 27 | }; |
| 28 | struct YB : XB { |
| 29 | using XB::XB; |
| 30 | }; |
| 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'}} |
| 34 | } |
| 35 | |