From cc8c7495d4bbfb9d0c8f1b6bb1a0b10e52cb45c8 Mon Sep 17 00:00:00 2001 From: Giovanni Bajo Date: Thu, 15 Jan 2004 01:46:11 +0000 Subject: 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 --- gcc/testsuite/ChangeLog | 6 +++++ gcc/testsuite/g++.dg/parse/casting-operator2.C | 27 ++++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/explicit83.C | 35 -------------------------- 3 files changed, 33 insertions(+), 35 deletions(-) create mode 100644 gcc/testsuite/g++.dg/parse/casting-operator2.C delete mode 100644 gcc/testsuite/g++.old-deja/g++.pt/explicit83.C (limited to 'gcc') 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 + + 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 * 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 +// PR c++/8856: Make sure template conversion operators are not parsed as +// template names. + +struct K {}; +template struct K2 {}; + +template struct A { + template operator U() { return U(); } +}; + +int main() { + A a; + + (void)a.operator int(); + (void)a.operator double(); + (void)a.operator K2(); + (void)a.A::operator int(); + (void)a.A::operator double(); + (void)a.A::operator K2(); + + (void)a.operator double(); // { dg-error "not a template" } + (void)a.operator K(); // { dg-error "not a template" } + (void)a.A::operator double(); // { dg-error "not a template" } + (void)a.A::operator K(); // { 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 - -// Bug 512. Conversion operator functions in template_id's were always -// being looked up in global scope. - -class C -{ -public: - - template - void f () {} - - template - operator int () - { return 0; - } -}; - -template void C::f (); - -template C::operator int (); - -template C::operator int (); - -typedef int (C::* ptrmem_t) (); - -template -void foo () -{ -} - -template void -foo<&C::operator int, &C::operator int > (); -- cgit v1.1