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++/49267] New: Ambiguity with conversion functions "T&" and "T&&", initializing a "T&&"


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

           Summary: Ambiguity with conversion functions "T&" and "T&&",
                    initializing a "T&&"
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schaub.johannes@googlemail.com


This is ambiguous with GCC, but probably should select the "T&":

    struct X {
      operator int&();
      operator int&&();
    };

    int&&x = X();

GCC says:

main1.cpp:7:16: error: conversion from âXâ to âintâ is ambiguous
main1.cpp:7:16: note: candidates are:
main1.cpp:4:7: note: X::operator int&&()
main1.cpp:3:7: note: X::operator int&()


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