brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · e03756e Raw
46 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -x c++ %s -verify2 3 4template<typename...>5concept C = false; // expected-note 9{{because}}6 7template<typename T>8struct S {9    template<typename U>10    static void foo1(U a, auto b);11    static void foo2(T a, C<T> auto b);12    // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}}13    static void foo3(T a, C<decltype(a)> auto b);14    // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}}15    static void foo4(T a, C<decltype(a)> auto b, const C<decltype(b)> auto &&c);16    // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}}17};18 19using sf1 = decltype(S<int>::foo1(1, 2));20using sf2 = decltype(S<int>::foo2(1, 2)); // expected-error{{no matching function}}21using sf3 = decltype(S<int>::foo3(1, 2)); // expected-error{{no matching function}}22using sf4 = decltype(S<int>::foo4(1, 2, 3)); // expected-error{{no matching function}}23 24 25template<typename... T>26struct G {27    static void foo1(auto a, const C<decltype(a)> auto &&... b);28    // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}} expected-note@-1 3{{and}}29    static void foo2(auto a, const C<decltype(a), T> auto &&... b);30    // expected-note@-1{{candidate template ignored}} expected-note@-1{{because}} expected-note@-1{{and}}31};32 33using gf1 = decltype(G<int, char>::foo1('a', 1, 2, 3, 4)); // expected-error{{no matching function}}34using gf2 = decltype(G<int, char>::foo2('a', 1, 2)); // expected-error{{no matching function}}35 36 37// Regression (bug #45102): check that instantiation works where there is no38// TemplateTypeParmDecl39template <typename T> using id = T;40 41template <typename T>42constexpr void g() {43  id<void (T)> f;44}45 46static_assert((g<int>(), true));