re PR c++/8856 (g++ accepts invalid conversion-function-id)
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>
Thu, 15 Jan 2004 01:46:11 +0000 (01:46 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Thu, 15 Jan 2004 01:46:11 +0000 (01:46 +0000)
PR c++/8856
* g++.dg/parse/casting-operator2.C: New test.
* g++.old-deja/g++.pt/explicit83.C: Remove.

From-SVN: r75898

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/casting-operator2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit83.C [deleted file]

index 2ac3cc83f98db5d65bdff834c5f2c53be458ac3a..ef55a94a957f141492267c3533a42eb2591065ee 100644 (file)
@@ -1,3 +1,9 @@
+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.
diff --git a/gcc/testsuite/g++.dg/parse/casting-operator2.C b/gcc/testsuite/g++.dg/parse/casting-operator2.C
new file mode 100644 (file)
index 0000000..31f14b3
--- /dev/null
@@ -0,0 +1,27 @@
+// { 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
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit83.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit83.C
deleted file mode 100644 (file)
index 9aa44f5..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// { 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> > ();