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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 61298
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61298&action=edit
Reduced testcase for the diagnostic issue

GCC gives for this:
```
<source>:8:6: error: could not convert '<brace-enclosed initializer list>()'
from '<brace-enclosed initializer list>' to 'foo'
    8 |    {}};
      |      ^
      |      |
      |      <brace-enclosed initializer list>
<source>:8:6: error: could not convert '<brace-enclosed initializer list>()'
from '<brace-enclosed initializer list>' to 'foo'
    8 |    {}};
      |      ^
      |      |
      |      <brace-enclosed initializer list>
<source>:8:6: error: could not convert '<brace-enclosed initializer list>()'
from '<brace-enclosed initializer list>' to 'const foo'
    8 |    {}};
      |      ^
      |      |
      |      <brace-enclosed initializer list>
<source>:8:6: error: could not convert '<brace-enclosed initializer list>()'
from '<brace-enclosed initializer list>' to 'const foo'
    8 |    {}};
      |      ^
      |      |
      |      <brace-enclosed initializer list>
```

While clang provides a correct location info:
```
<source>:7:4: error: no matching constructor for initialization of 'const foo'
    7 |   {{},
      |    ^~
<source>:2:13: note: candidate constructor not viable: requires single argument
'lo', but no arguments were provided
    2 |   constexpr foo(int lo) : l { lo } {}
      |             ^   ~~~~~~
<source>:1:8: note: candidate constructor (the implicit copy constructor) not
viable: requires 1 argument, but 0 were provided
    1 | struct foo {
      |        ^~~
<source>:1:8: note: candidate constructor (the implicit move constructor) not
viable: requires 1 argument, but 0 were provided
    1 | struct foo {
      |        ^~~
<source>:8:4: error: no matching constructor for initialization of 'const foo'
    8 |    {}};
      |    ^~
<source>:2:13: note: candidate constructor not viable: requires single argument
'lo', but no arguments were provided
    2 |   constexpr foo(int lo) : l { lo } {}
      |             ^   ~~~~~~
<source>:1:8: note: candidate constructor (the implicit copy constructor) not
viable: requires 1 argument, but 0 were provided
    1 | struct foo {
      |        ^~~
<source>:1:8: note: candidate constructor (the implicit move constructor) not
viable: requires 1 argument, but 0 were provided
    1 | struct foo {
      |        ^~~

```

Reply via email to