12350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor// RUN: %clang_cc1 -fsyntax-only -verify %s
22350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor
32350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor// PR7463: Make sure that when we have an rvalue, it does not have
42350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor// cv-qualified non-class type.
52350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregortemplate <typename T_> void g (T_&); // expected-note 7{{not viable}}
62350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor
72350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregortemplate<const int X> void h() {
82350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  g(X); // expected-error{{no matching function for call to 'g'}}
92350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor}
102350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor
112350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregortemplate<typename T, T X> void h2() {
122350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  g(X); // expected-error{{no matching function for call to 'g'}}
132350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor}
142350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor
152350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregorvoid a(__builtin_va_list x) {
162350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  g(__builtin_va_arg(x, const int)); // expected-error{{no matching function for call to 'g'}}
172350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  g((const int)0); // expected-error{{no matching function for call to 'g'}}
182350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  typedef const int cint;
192350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  g(cint(0)); // expected-error{{no matching function for call to 'g'}}
202350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  g(static_cast<const int>(1)); // expected-error{{no matching function for call to 'g'}}
212350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  g(reinterpret_cast<int *const>(0)); // expected-error{{no matching function for call to 'g'}}
222350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  h<0>();
232350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor  h2<const int, 0>(); // expected-note{{instantiation of}}
242350fb26d59692c6006ec5d33b8215e96055bdb6Douglas Gregor}
25