struct H {
    operator char();
    operator short();
};

int const& ref = H();

output:
oref.cpp:7: error: conversion from 'H' to 'const int' is ambiguous
oref.cpp:4: note: candidates are: H::operator short int()
oref.cpp:3: note:                 H::operator char()
oref.cpp:7: internal compiler error: tree check: expected class 'type', have 
'exceptional' (error_mark) in initialize_reference, at cp/call.c:6586
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

using:
$ g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages=c++,c --enable-
threads=posix
Thread model: posix
gcc version 4.0.0 20050203 (experimental)


This is a regression from earlier versions. There does not seem to be any 
problems if I do the reference binding in block scope.


Mikael

-- 
           Summary: Internal compiler error with ambiguous conversion
                    functions
           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=19787

Reply via email to