This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/8856: g++ accepts invalid conversion-function-id
- From: Martin von Loewis <loewis at informatik dot hu-berlin dot de>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Sat, 7 Dec 2002 12:27:03 +0100 (CET)
- Subject: c++/8856: g++ accepts invalid conversion-function-id
>Number: 8856
>Category: c++
>Synopsis: g++ accepts invalid conversion-function-id
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Sat Dec 07 03:36:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Martin v. Löwis
>Release: 3.1
>Organization:
>Environment:
System: SunOS paros 5.9 Generic_112233-02 sun4u sparc SUNW,Sun-Blade-1000
Architecture: sun4
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../configure --host=sparc-sun-solaris2.8 --enable-shared --enable-threads --with-cpu=v8 --with-gnu-ld --with-gnu-as --enable-version-specific-runtime-libs
>Description:
The following program is accepted, even though operator double<int>
is not a valid conversion-function-id (as double is not a template).
#include <stdio.h>
template <class T> struct A {
template <class U> operator U() { return sizeof(U); }
};
int main() {
A<double> a;
int x = a.A<double>::operator int();
double y = a.A<double>::operator double();
int z = a.A<double>::operator double<int>();
printf("%d %f %d\n", x, y, z);
}
>How-To-Repeat:
Compile the above program.
>Fix:
Work-around: don't use the construct.
>Release-Note:
>Audit-Trail:
>Unformatted: