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

            Bug ID: 89486
           Summary: GCC fails to compile designated initializer use
                    involving implicit conversion
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: st at quanttec dot com
  Target Milestone: ---

The following code fails to compile with the current trunk version of GCC.
clang compiles the code fine.

struct P {
  int a = 0;
  void* b;
};

void f(P) {}

void test() {
  f({.b = nullptr});
}

<source>: In function 'void test()':
<source>:9:19: error: could not convert '{nullptr}' from '<brace-enclosed
initializer list>' to 'P'

    9 |   f({.b = nullptr});

      |                   ^

      |                   |

      |                   <brace-enclosed initializer list>

Compiler returned: 1

Reply via email to