public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58255] New: [C++11] explicit delegating constructor with no arguments wrongly rejected
@ 2013-08-28  0:25 ppluzhnikov at google dot com
  2013-08-28 11:06 ` [Bug c++/58255] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ppluzhnikov at google dot com @ 2013-08-28  0:25 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug c++/58255] [C++11] explicit delegating constructor with no arguments wrongly rejected
  2013-08-28  0:25 [Bug c++/58255] New: [C++11] explicit delegating constructor with no arguments wrongly rejected ppluzhnikov at google dot com
@ 2013-08-28 11:06 ` paolo.carlini at oracle dot com
  2013-08-28 11:28 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-28 11:06 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-08-28
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.9.0
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Seems easy.


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

* [Bug c++/58255] [C++11] explicit delegating constructor with no arguments wrongly rejected
  2013-08-28  0:25 [Bug c++/58255] New: [C++11] explicit delegating constructor with no arguments wrongly rejected ppluzhnikov at google dot com
  2013-08-28 11:06 ` [Bug c++/58255] " paolo.carlini at oracle dot com
@ 2013-08-28 11:28 ` paolo.carlini at oracle dot com
  2013-08-28 22:40 ` paolo at gcc dot gnu.org
  2013-08-28 22:41 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-28 11:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I'm finishing testing this:

Index: init.c
===================================================================
--- init.c    (revision 202020)
+++ init.c    (working copy)
@@ -1465,6 +1465,7 @@ build_aggr_init (tree exp, tree init, int flags, t
   TREE_THIS_VOLATILE (exp) = 0;

   if (init && TREE_CODE (init) != TREE_LIST
+      && init != void_type_node
       && !(TREE_CODE (init) == TARGET_EXPR
        && TARGET_EXPR_DIRECT_INIT_P (init))
       && !(BRACE_ENCLOSED_INITIALIZER_P (init)


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

* [Bug c++/58255] [C++11] explicit delegating constructor with no arguments wrongly rejected
  2013-08-28  0:25 [Bug c++/58255] New: [C++11] explicit delegating constructor with no arguments wrongly rejected ppluzhnikov at google dot com
  2013-08-28 11:06 ` [Bug c++/58255] " paolo.carlini at oracle dot com
  2013-08-28 11:28 ` paolo.carlini at oracle dot com
@ 2013-08-28 22:40 ` paolo at gcc dot gnu.org
  2013-08-28 22:41 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-08-28 22:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Wed Aug 28 22:40:34 2013
New Revision: 202061

URL: http://gcc.gnu.org/viewcvs?rev=202061&root=gcc&view=rev
Log:
/cp
2013-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58255
    * init.c (build_aggr_init): When init == void_type_node do not
    set LOOKUP_ONLYCONVERTING.

/testsuite
2013-08-28  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/58255
    * g++.dg/cpp0x/dc7.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/dc7.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/init.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/58255] [C++11] explicit delegating constructor with no arguments wrongly rejected
  2013-08-28  0:25 [Bug c++/58255] New: [C++11] explicit delegating constructor with no arguments wrongly rejected ppluzhnikov at google dot com
                   ` (2 preceding siblings ...)
  2013-08-28 22:40 ` paolo at gcc dot gnu.org
@ 2013-08-28 22:41 ` paolo.carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-28 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed for 4.9.0.


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

end of thread, other threads:[~2013-08-28 22:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-28  0:25 [Bug c++/58255] New: [C++11] explicit delegating constructor with no arguments wrongly rejected ppluzhnikov at google dot com
2013-08-28 11:06 ` [Bug c++/58255] " paolo.carlini at oracle dot com
2013-08-28 11:28 ` paolo.carlini at oracle dot com
2013-08-28 22:40 ` paolo at gcc dot gnu.org
2013-08-28 22:41 ` 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).