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

            Bug ID: 59074
           Summary: incorrect "call of overloaded .. is ambiguous" error
                    when changing base class to virtual
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: c...@tempest-sw.com

Created attachment 31191
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31191&action=edit
compile to demonstrate problem

$ g++-4.8 -fsyntax-only -std=c++11 gccbug.cpp
gccbug.cpp: In constructor ‘derived::derived(const string&)’:
gccbug.cpp:21:15: error: call of overloaded ‘base2(<brace-enclosed initializer
list>)’ is ambiguous
    : base2{str}
               ^
gccbug.cpp:21:15: note: candidates are:
gccbug.cpp:15:4: note: base2::base2(const string&)
    base2(string const&) {}
    ^
gccbug.cpp:13:7: note: base2::base2(const base2&)
 class base2 : virtual public base1 {
       ^
gccbug.cpp:13:7: note: base2::base2(base2&&)
$ 


Remove the "virtual" keyword, and the example passes syntax check without any
error messages.

Clang 3.3 accepts original and edited version without any error messages.

I thought this might be related to #58052, but the fact that removing the
virtual base class eliminates the problem convinced me that it must be
something different.


gcc 4.8.2 on OpenSUSE 12.3 (downloaded as version 4.8.2+r203692-61.1 from the
OpenSUSE devel:gcc repository)

$ gcc --version
gcc-4.8 (SUSE Linux) 4.8.2 20131016 [gcc-4_8-branch revision 203692]
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to