aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-01-15 01:46:11 +0000
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>2004-01-15 01:46:11 +0000
commitcc8c7495d4bbfb9d0c8f1b6bb1a0b10e52cb45c8 (patch)
tree22af60ab4a7c6bd599d9d06f3b084f77f5d3d82a
parent0d9564747f44c5d650c3dad74097c063f9a12ad3 (diff)
downloadgcc-cc8c7495d4bbfb9d0c8f1b6bb1a0b10e52cb45c8.zip
gcc-cc8c7495d4bbfb9d0c8f1b6bb1a0b10e52cb45c8.tar.gz
gcc-cc8c7495d4bbfb9d0c8f1b6bb1a0b10e52cb45c8.tar.bz2
re PR c++/8856 (g++ accepts invalid conversion-function-id)
PR c++/8856 * g++.dg/parse/casting-operator2.C: New test. * g++.old-deja/g++.pt/explicit83.C: Remove. From-SVN: r75898
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/parse/casting-operator2.C27
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit83.C35
3 files changed, 33 insertions, 35 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ac3cc8..ef55a94 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..31f14b3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/casting-operator2.C
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// Contributed by Martin Loewis <loewis at informatik dot hu-berlin dot de>
+// PR c++/8856: Make sure template conversion operators are not parsed as
+// template names.
+
+struct K {};
+template <bool> struct K2 {};
+
+template <class T> struct A {
+ template <class U> operator U() { return U(); }
+};
+
+int main() {
+ A<double> a;
+
+ (void)a.operator int();
+ (void)a.operator double();
+ (void)a.operator K2<true>();
+ (void)a.A<double>::operator int();
+ (void)a.A<double>::operator double();
+ (void)a.A<double>::operator K2<true>();
+
+ (void)a.operator double<int>(); // { dg-error "not a template" }
+ (void)a.operator K<int>(); // { dg-error "not a template" }
+ (void)a.A<double>::operator double<int>(); // { dg-error "not a template" }
+ (void)a.A<double>::operator K<int>(); // { dg-error "not a template" }
+}
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
index 9aa44f5..0000000
--- a/gcc/testsuite/g++.old-deja/g++.pt/explicit83.C
+++ /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> > ();