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++/58255] New: [C++11] explicit delegating constructor with no arguments wrongly rejected


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

            Bug ID: 58255
           Summary: [C++11] explicit delegating constructor with no
                    arguments wrongly rejected
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppluzhnikov at google dot com

Google ref: b/10458361

Test:

struct A {
  explicit A() { }   // remove explicit -> compiles fine
  A(int x) : A() { }
};


Builds with Clang.
Fails using g++ (GCC) 4.9.0 20130827 (experimental):


g++ -c -std=c++11  /tmp/t1.cc -o /tmp/t.o
/tmp/t1.cc: In constructor 'A::A(int)':
/tmp/t1.cc:3:16: error: no matching function for call to 'A::A()'
   A(int x) : A() { }
                ^
/tmp/t1.cc:3:16: note: candidates are:
/tmp/t1.cc:3:3: note: A::A(int)
   A(int x) : A() { }
   ^
/tmp/t1.cc:3:3: note:   candidate expects 1 argument, 0 provided
/tmp/t1.cc:1:8: note: constexpr A::A(const A&)
 struct A {
        ^
/tmp/t1.cc:1:8: note:   candidate expects 1 argument, 0 provided
/tmp/t1.cc:1:8: note: constexpr A::A(A&&)
/tmp/t1.cc:1:8: note:   candidate expects 1 argument, 0 provided


This has been broken since at least gcc-4.7


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