xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/cv-unqual-rvalues.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // PR7463: Make sure that when we have an rvalue, it does not have
4*f4a2713aSLionel Sambuc // cv-qualified non-class type.
5*f4a2713aSLionel Sambuc template <typename T_> void g (T_&); // expected-note 7{{not viable}}
6*f4a2713aSLionel Sambuc 
h()7*f4a2713aSLionel Sambuc template<const int X> void h() {
8*f4a2713aSLionel Sambuc   g(X); // expected-error{{no matching function for call to 'g'}}
9*f4a2713aSLionel Sambuc }
10*f4a2713aSLionel Sambuc 
h2()11*f4a2713aSLionel Sambuc template<typename T, T X> void h2() {
12*f4a2713aSLionel Sambuc   g(X); // expected-error{{no matching function for call to 'g'}}
13*f4a2713aSLionel Sambuc }
14*f4a2713aSLionel Sambuc 
a(__builtin_va_list x)15*f4a2713aSLionel Sambuc void a(__builtin_va_list x) {
16*f4a2713aSLionel Sambuc   g(__builtin_va_arg(x, const int)); // expected-error{{no matching function for call to 'g'}}
17*f4a2713aSLionel Sambuc   g((const int)0); // expected-error{{no matching function for call to 'g'}}
18*f4a2713aSLionel Sambuc   typedef const int cint;
19*f4a2713aSLionel Sambuc   g(cint(0)); // expected-error{{no matching function for call to 'g'}}
20*f4a2713aSLionel Sambuc   g(static_cast<const int>(1)); // expected-error{{no matching function for call to 'g'}}
21*f4a2713aSLionel Sambuc   g(reinterpret_cast<int *const>(0)); // expected-error{{no matching function for call to 'g'}}
22*f4a2713aSLionel Sambuc   h<0>();
23*f4a2713aSLionel Sambuc   h2<const int, 0>(); // expected-note{{instantiation of}}
24*f4a2713aSLionel Sambuc }
25