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

            Bug ID: 118766
           Summary: Garbled error message in vararg requires
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sandberg.sven at gmail dot com
  Target Milestone: ---

The following program produces an error message that appears garbled (see also
https://godbolt.org/z/vxTa73d14). Note that I am not questioning that this code
is wrong (clang agrees that it is), only suggesting that the message should be
more clear.

```
template <class... Args_t>
    requires requires (const Args_t &... a) { f(a...); }
void g(const Args_t &... arg) {}

int main() {
    g();
    return 0;
}
```

The error message, up to the garbled line, is:

```
In function 'int main()':
<source>:6:6: error: no matching function for call to 'g(const char [1])'
    6 |     g("");
      |     ~^~~~
<source>:6:6: note: there is 1 candidate
<source>:3:6: note: candidate 1: 'template<class ... Args_t>  requires
requires('type_pack_expansion' not supported by simple_type_specifier...
a'type_pack_expansion' not supported by direct_abstract_declarator) {f(a ...);}
void g(const Args_t& ...)'
```

It is confusing to see the internal-looking identifiers `simple_type_specifier`
and `direct_abstract_declarator` and the English text `not supported by` in the
middle of the parameter list, instead of the parameter type.

Reply via email to