This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/28557] New: [4.0/4.1/4.2 regression] Trouble with templated type conversion operator


The following valid code snippet is rejected since GCC 4.0.3.
On mainline it even triggers an ICE:

=========================================================
struct A
{
    template<typename T> operator T() { return T(); }
};

template<int> void foo()
{
    A().operator int();
}

void bar()
{
    foo<0>();
}
=========================================================

bug.cc: In function 'void foo() [with int <anonymous> = 0]':
bug.cc:13:   instantiated from here
bug.cc:8: error: invalid use of template type parameter
bug.cc: In member function 'A::operator T() [with T = T]':
bug.cc:8:   instantiated from 'void foo() [with int <anonymous> = 0]'
bug.cc:13:   instantiated from here
bug.cc:3: internal compiler error: in dependent_type_p, at cp/pt.c:12523
Please submit a full bug report, [etc.]

The code compiles fine, if I turn foo into a regular function.


-- 
           Summary: [4.0/4.1/4.2 regression] Trouble with templated type
                    conversion operator
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code, rejects-valid, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]