[Bug c++/18722] New: template conversion function regression

belz at kolumbus dot fi gcc-bugzilla@gcc.gnu.org
Mon Nov 29 17:33:00 GMT 2004


Bug #9126 is well known, however it seems the current g++ 4.0.0 cvs version does 
not even allow overloading a templated conversion function.

struct A {
    template<typename T>
    operator T() const;

    operator float() const;
};


$ g++ templ_conv.cpp
templ_conv.cpp:6: error: declaration of 'A::operator float() const'
templ_conv.cpp:4: error: conflicts with previous declaration 'A::operator T() 
const'

I have tested with many 4.0.0 versions, the last one was:

$ g++ -v
Reading specs from /usr/local/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --enable-languages=c++,c --enable-
threads=posix
Thread model: posix
gcc version 4.0.0 20041129 (experimental)


Mikael

-- 
           Summary: template conversion function regression
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: belz at kolumbus dot fi
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18722



More information about the Gcc-bugs mailing list