https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105221
Bug ID: 105221
Summary: gcc rejects true ? [](auto) noexcept {} : [](int) {}
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
int main() {
true ? [](auto) noexcept {} : [](int) {};
}
GCC-trunk only accepts the above code in C++14 but rejects it in C++17/20.
https://godbolt.org/z/7r4dKbo73
But it seems like it should be well-formed, you can see the explanation in SO:
https://stackoverflow.com/questions/71826315/ternary-operator-applied-to-different-lambdas-produces-inconsistent-results