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

            Bug ID: 125807
           Summary: parameter used in noexcept-specifier incorrectly
                    rejected
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: waffl3x at gcc dot gnu.org
  Target Milestone: ---

https://godbolt.org/z/nn9T7re9T
```
template<typename T>
consteval bool g(T&&) { return true; }

struct S {
  consteval operator bool() { return true; }
};

template<typename T>
void f0(T a) noexcept(g(a)) {}

template void f0<int>(int);
template void f0<S>(S);

template<typename T>
void f1(T a) noexcept(a) {}

template void f1<S>(S);
```
This is allowed at least in C++23 with P1787R6. It is possible that
there were earlier changes that clarified the scope of parameters that
allow it, but I did not want to do any more digging through history.

An additional minimal reproducer, by my reading of the standard this
should also be correct. I did not include it in the godbolt link as it
is not accepted by MSVC.
```
template<typename T>
void f(T a) noexcept((a,true)) {}
```

Reply via email to