mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
0d9564747f
commit
cc8c7495d4
|
@ -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.
|
||||
|
|
|
@ -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" }
|
||||
}
|
|
@ -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> > ();
|
Loading…
Reference in New Issue