* g++.dg/parse/casting-operator2.C: New test.
* g++.old-deja/g++.pt/explicit83.C: Remove.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75898
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-01-15 Giovanni Bajo <giovannibajo@gcc.gnu.org>
+
+ PR c++/8856
+ * g++.dg/parse/casting-operator2.C: New test.
+ * g++.old-deja/g++.pt/explicit83.C: Remove.
+
2004-01-14 Joseph S. Myers <jsm@polyomino.org.uk>
* gcc.dg/label-compound-stmt-1.c: New test.
--- /dev/null
+// { dg-do compile }\r
+// Contributed by Martin Loewis <loewis at informatik dot hu-berlin dot de>\r
+// PR c++/8856: Make sure template conversion operators are not parsed as\r
+// template names.\r
+\r
+struct K {};\r
+template <bool> struct K2 {};\r
+\r
+template <class T> struct A {\r
+ template <class U> operator U() { return U(); }\r
+};\r
+\r
+int main() {\r
+ A<double> a;\r
+\r
+ (void)a.operator int();\r
+ (void)a.operator double();\r
+ (void)a.operator K2<true>();\r
+ (void)a.A<double>::operator int();\r
+ (void)a.A<double>::operator double();\r
+ (void)a.A<double>::operator K2<true>();\r
+\r
+ (void)a.operator double<int>(); // { dg-error "not a template" }\r
+ (void)a.operator K<int>(); // { dg-error "not a template" }\r
+ (void)a.A<double>::operator double<int>(); // { dg-error "not a template" }\r
+ (void)a.A<double>::operator K<int>(); // { dg-error "not a template" }\r
+}\r
+++ /dev/null
-// { dg-do assemble }
-// Copyright (C) 2000 Free Software Foundation, Inc.
-// Contributed by Nathan Sidwell 7 Sep 2000 <nathan@codesourcery.com>
-
-// Bug 512. Conversion operator functions in template_id's were always
-// being looked up in global scope.
-
-class C
-{
-public:
-
- template <typename T>
- void f () {}
-
- template<typename T>
- operator int ()
- { return 0;
- }
-};
-
-template void C::f <int>();
-
-template C::operator int<float> ();
-
-template C::operator int<double> ();
-
-typedef int (C::* ptrmem_t) ();
-
-template<ptrmem_t U, ptrmem_t V>
-void foo ()
-{
-}
-
-template void
-foo<&C::operator int<float>, &C::operator int<double> > ();