public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59296] New: [c++11] ref-qualified member function is ambiguous
@ 2013-11-26  4:14 eric.niebler at gmail dot com
  2013-11-26 11:22 ` [Bug c++/59296] " redi at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: eric.niebler at gmail dot com @ 2013-11-26  4:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 59296
           Summary: [c++11] ref-qualified member function is ambiguous
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eric.niebler at gmail dot com

The following code fails to compile:

struct S
{
    constexpr int foo() const & { return 0; }
    constexpr int foo() const && { return 42; }
};

int main()
{
    constexpr int i = S{}.foo();
}

The error I get is:

$ /usr/local/gcc-4.8.2/bin/g++ -std=gnu++11 -c test.cpp
test.cpp: In function ‘int main()’:
test.cpp:9:31: error: call of overloaded ‘foo()’ is ambiguous
     constexpr int i = S{}.foo();
                               ^
test.cpp:9:31: note: candidates are:
test.cpp:3:19: note: constexpr int S::foo() const &
     constexpr int foo() const & { return 0; }
                   ^
test.cpp:4:19: note: constexpr int S::foo() const &&
     constexpr int foo() const && { return 42; }
                   ^

The code in question is not ambiguous. The object is clearly an rvalue, so the
&&-qualified member should be preferred.
>From gcc-bugs-return-435853-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Nov 26 04:24:03 2013
Return-Path: <gcc-bugs-return-435853-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 3218 invoked by alias); 26 Nov 2013 04:24:02 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 3177 invoked by uid 48); 26 Nov 2013 04:23:55 -0000
From: "d.g.gorbachev at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/59179] [4.9 Regression] Wrong code generated with -Og
Date: Tue, 26 Nov 2013 04:24:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: rtl-optimization
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: d.g.gorbachev at gmail dot com
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.9.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-59179-4-brqdqE3OvZ@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-59179-4@http.gcc.gnu.org/bugzilla/>
References: <bug-59179-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg02630.txt.bz2
Content-length: 465

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY179

Dmitry Gorbachev <d.g.gorbachev at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #2 from Dmitry Gorbachev <d.g.gorbachev at gmail dot com> ---
GCC 4.9.0 20131124 - works.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-11-19  9:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-26  4:14 [Bug c++/59296] New: [c++11] ref-qualified member function is ambiguous eric.niebler at gmail dot com
2013-11-26 11:22 ` [Bug c++/59296] " redi at gcc dot gnu.org
2014-03-26 18:52 ` redi at gcc dot gnu.org
2014-03-26 18:54 ` redi at gcc dot gnu.org
2014-06-18 21:00 ` jason at gcc dot gnu.org
2014-06-18 22:14 ` jason at gcc dot gnu.org
2014-06-19  9:35 ` jason at gcc dot gnu.org
2014-06-19  9:36 ` jason at gcc dot gnu.org
2014-06-20 18:33 ` jason at gcc dot gnu.org
2014-06-20 18:35 ` jason at gcc dot gnu.org
2014-11-19  9:59 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).