1 // { dg-do compile }
2 // Contributed by Martin Loewis <loewis at informatik dot hu-berlin dot de>
3 // PR c++/8856: Make sure template conversion operators are not parsed as
4 //   template names.
5 
6 struct K {};
7 template <bool> struct K2 {};
8 
9 template <class T> struct A {
UA10   template <class U> operator U() { return U(); }
11 };
12 
main()13 int main() {
14   A<double> a;
15 
16   (void)a.operator int();
17   (void)a.operator double();
18   (void)a.operator K2<true>();
19   (void)a.A<double>::operator int();
20   (void)a.A<double>::operator double();
21   (void)a.A<double>::operator K2<true>();
22 
23   (void)a.operator double<int>();             // { dg-error "not a template" }
24   (void)a.operator K<int>();                  // { dg-error "not a template" }
25   (void)a.A<double>::operator double<int>();  // { dg-error "not a template" }
26   (void)a.A<double>::operator K<int>();       // { dg-error "not a template" }
27 }
28