>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 is not a valid conversion-function-id (as double is not a template). #include template struct A { template operator U() { return sizeof(U); } }; int main() { A a; int x = a.A::operator int(); double y = a.A::operator double(); int z = a.A::operator double(); 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: