Skip to content

No move elision in construction from nested brace-enclosed initializer list #137862

Open
@Fedr

Description

@Fedr

This program

struct B {
    int i, j;
};

struct A {
    A(A&&) = delete;
    A(const B &) {}
};

A a( { { 1, 2 } } );

is accepted by GCC and EDG. But Clang complains:

<source>:10:3: error: call to deleted constructor of 'A'
   10 | A a( { { 1, 2 } } );
      |   ^  ~~~~~~~~~~~~
<source>:6:5: note: 'A' has been explicitly marked deleted here
    6 |     A(A&&) = delete;
      |     ^

Online demo: https://gcc.godbolt.org/z/eT9M59acx

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions