https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91319

            Bug ID: 91319
           Summary: Designated initializer doesn't support
                    direct-initialization
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

This currently fails to compile on trunk:

struct X {
    explicit X() { }
};

struct Aggr {
    X x;
};

Aggr f() {
    return Aggr{.x{}};
}

source>: In function 'Aggr f()':
<source>:10:21: error: converting to 'X' from initializer list would use
explicit constructor 'X::X()'
   10 |     return Aggr{.x{}};
      |                     ^
Compiler returned: 1

But it's intended to work (this is CWG 2359).

Reply via email to