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: [email protected]
ReportedBy: [email protected]
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&()