1 | // RUN: %clang_cc1 -std=c++11 -verify %s |
2 | |
3 | struct Q { typedef int type; }; |
4 | |
5 | // "The substitution occurs in all types and expressions that are used in [...] |
6 | // template parameter declarations." In particular, we must substitute into the |
7 | // type of a parameter pack that is not a pack expansion, even if we know the |
8 | // corresponding argument pack is empty. |
9 | template<typename T, typename T::type...> void a(T); |
10 | int &a(...); |
11 | int &a_disabled = a(0); |
12 | int &a_enabled = a(Q()); // expected-error {{cannot bind to a temporary of type 'void'}} |
13 | |
14 | template<typename T, template<typename T::type> class ...X> void b(T); |
15 | int &b(...); |
16 | int &b_disabled = b(0); |
17 | int &b_enabled = b(Q()); // expected-error {{cannot bind to a temporary of type 'void'}} |
18 | |
19 | template<typename T, template<typename T::type...> class ...X> void c(T); |
20 | int &c(...); |
21 | int &c_disabled = c(0); |
22 | int &c_enabled = c(Q()); // expected-error {{cannot bind to a temporary of type 'void'}} |
23 | |