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