This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49267] New: Ambiguity with conversion functions "T&" and "T&&", initializing a "T&&"
- From: "schaub.johannes at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 2 Jun 2011 18:14:54 +0000
- Subject: [Bug c++/49267] New: Ambiguity with conversion functions "T&" and "T&&", initializing a "T&&"
- Auto-submitted: auto-generated
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&()