Clang Project

clang_source_code/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp
1// RUN: %clang_cc1 -std=c++11 -verify %s
2
3struct 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.
9template<typename T, typename T::type...> void a(T);
10int &a(...);
11int &a_disabled = a(0);
12int &a_enabled = a(Q()); // expected-error {{cannot bind to a temporary of type 'void'}}
13
14template<typename T, template<typename T::type> class ...X> void b(T);
15int &b(...);
16int &b_disabled = b(0);
17int &b_enabled = b(Q()); // expected-error {{cannot bind to a temporary of type 'void'}}
18
19template<typename T, template<typename T::type...> class ...X> void c(T);
20int &c(...);
21int &c_disabled = c(0);
22int &c_enabled = c(Q()); // expected-error {{cannot bind to a temporary of type 'void'}}
23