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

            Bug ID: 95735
           Summary: ICE on invalid non-type template argument
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/v7iLPn.
```C++
template <auto F>
    requires requires { F(); }
bool v{};

void f() {
    int x;
    static_assert(v<throw>);
}
```
<source>: In function 'void f()':
<source>:7:19: error: parse error in template argument list
    7 |     static_assert(v<throw>);
      |                   ^~~~~~~~
<source>:7:19: error: template argument 1 is invalid
<source>:7: confused by earlier errors, bailing out
Compiler returned: 1

Less silly example: https://godbolt.org/z/-bWfJ4.
```C++
template <auto F>
    requires requires { F(); }
bool v{};

void f() {
    int x;
    static_assert(v<[&] { x++; }>);
}
```
<source>: In function 'void f()':
<source>:7:19: error: '<lambda closure object>f()::<lambda()>{x}' is not a
constant expression
    7 |     static_assert(v<[&] { x++; }>);
      |                   ^~~~~~~~~~~~~~~
<source>:7: confused by earlier errors, bailing out
Compiler returned: 1

Reply via email to