[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-03-16 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-01-29 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

--- Comment #7 from Marek Polacek  ---
Actually this might be just a missing TARGET_EXPR_DIRECT_INIT_P check in
build_special_member_call:

--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -8824,7 +8824,8 @@ build_special_member_call (tree instance, tree name,
vec **args,
arg = perform_implicit_conversion_flags (class_type, arg,
 sub_complain,
 flags);
-  if ((TREE_CODE (arg) == TARGET_EXPR
+  if (((TREE_CODE (arg) == TARGET_EXPR
+   && TARGET_EXPR_DIRECT_INIT_P (arg))
   || TREE_CODE (arg) == CONSTRUCTOR)
  && (same_type_ignoring_top_level_qualifiers_p
  (class_type, TREE_TYPE (arg

[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-01-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

Marek Polacek  changed:

   What|Removed |Added

 CC||mpolacek at gcc dot gnu.org

--- Comment #6 from Marek Polacek  ---
struct S
{
S(int i = 42); // (1)
};

void f()
{
S( {} ); // (2)
}

So if I understand this right, (2) is a copy-list-initialization which is
supposed to initialize the constructor's parameter in (1), i.e. an integer to
0, as if we wrote int i = {} (copy-list-initialization), not the type S.  But
the latter is what's happening in C++17 and that is wrong.

[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-01-25 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|7.3 |7.4

--- Comment #5 from Richard Biener  ---
GCC 7.3 is being released, adjusting target milestone.

[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-01-19 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||accepts-invalid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-01-19
 Ever confirmed|0   |1

--- Comment #4 from Jonathan Wakely  ---
I don't think P0135 should cause S( {} ) to mean S( S{} ) so I agree that the
C++17 behaviour is wrong.

[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-01-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-01-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

--- Comment #3 from Jakub Jelinek  ---
Link to P0135: http://wg21.link/p0135

[Bug c++/83937] [7/8 Regression] C++17 binds braced init of a type T to default arg of a ctor instead of using T's own default ctor

2018-01-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

Jakub Jelinek  changed:

   What|Removed |Added

   Keywords|FIXME   |
 CC||jakub at gcc dot gnu.org,
   ||jason at gcc dot gnu.org,
   ||nathan at gcc dot gnu.org,
   ||redi at gcc dot gnu.org
   Target Milestone|--- |7.3
Summary|[REGRESSION] C++17 binds|[7/8 Regression] C++17
   |braced init of a type T to  |binds braced init of a type
   |default arg of a ctor   |T to default arg of a ctor
   |instead of using T's own|instead of using T's own
   |default ctor|default ctor

--- Comment #2 from Jakub Jelinek  ---
This changed with r240889 aka P0135 refinement, but whether it is intentional
and why, or a bug, I'll defer to the C++ folks.