https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112436
Bug ID: 112436
Summary: SFINAE-unfriendly error on throwing pointer to
incomplete type
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: arthur.j.odwyer at gmail dot com
Target Milestone: ---
====
template<class T>
concept Throwable = requires { throw T(); };
struct Incomplete;
static_assert(!Throwable<Incomplete*>);
static_assert(!Throwable<int(*)[]>);
====
<source>:2:32: error: invalid use of incomplete type 'struct Incomplete'
2 | concept Throwable = requires { throw T(); };
| ^~~~~~~~~
<source>:3:8: note: forward declaration of 'struct Incomplete'
3 | struct Incomplete;
| ^~~~~~~~~~
<source>:2:32: error: invalid use of array with unspecified bounds
2 | concept Throwable = requires { throw T(); };
| ^~~~~~~~~
Instead of a hard error in both cases, we expect the concept to be false and
the static_assert to succeed. Clang and EDG succeed. MSVC succeeds on
`Incomplete*` and incorrectly permits throwing `int(*)[]`.
The terse/multi-purpose "invalid use of..." error message seems to come up a
lot in Bugzilla, but I didn't see any search hits for that message plus the
word "throw".
Bug #98388 is probably related.