public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112436] New: SFINAE-unfriendly error on throwing pointer to incomplete type
@ 2023-11-08 5:12 arthur.j.odwyer at gmail dot com
2023-11-08 5:24 ` [Bug c++/112436] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: arthur.j.odwyer at gmail dot com @ 2023-11-08 5:12 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/112436] SFINAE-unfriendly error on throwing pointer to incomplete type
2023-11-08 5:12 [Bug c++/112436] New: SFINAE-unfriendly error on throwing pointer to incomplete type arthur.j.odwyer at gmail dot com
@ 2023-11-08 5:24 ` pinskia at gcc dot gnu.org
2024-02-10 15:54 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-08 5:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112436
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=112437
Ever confirmed|0 |1
Last reconfirmed| |2023-11-08
Status|UNCONFIRMED |NEW
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
While looking into this to see if a slightly different testcase would work, I
found PR 112437 which ICEs.
Note there needs to be a complete type; using an incomplete type causes the
error message like here.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/112436] SFINAE-unfriendly error on throwing pointer to incomplete type
2023-11-08 5:12 [Bug c++/112436] New: SFINAE-unfriendly error on throwing pointer to incomplete type arthur.j.odwyer at gmail dot com
2023-11-08 5:24 ` [Bug c++/112436] " pinskia at gcc dot gnu.org
@ 2024-02-10 15:54 ` mpolacek at gcc dot gnu.org
2024-02-13 13:57 ` cvs-commit at gcc dot gnu.org
2024-02-13 14:00 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-02-10 15:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112436
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |mpolacek at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/112436] SFINAE-unfriendly error on throwing pointer to incomplete type
2023-11-08 5:12 [Bug c++/112436] New: SFINAE-unfriendly error on throwing pointer to incomplete type arthur.j.odwyer at gmail dot com
2023-11-08 5:24 ` [Bug c++/112436] " pinskia at gcc dot gnu.org
2024-02-10 15:54 ` mpolacek at gcc dot gnu.org
@ 2024-02-13 13:57 ` cvs-commit at gcc dot gnu.org
2024-02-13 14:00 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-02-13 13:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112436
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:ecc119effe1aa445cb973c8cbb5ef3830f256f13
commit r14-8958-gecc119effe1aa445cb973c8cbb5ef3830f256f13
Author: Marek Polacek <polacek@redhat.com>
Date: Sat Feb 10 10:52:18 2024 -0500
c++: SFINAE-unfriendly error on throwing pointer [PR112436]
On the heels of r14-8903, this patch adds further complain parameters
so that we don't emit "invalid use of incomplete type" from inside
a concept.
PR c++/112436
gcc/cp/ChangeLog:
* except.cc (expand_start_catch_block): Pass tf_warning_or_error to
is_admissible_throw_operand_or_catch_parameter.
(build_throw): Pass complain to
is_admissible_throw_operand_or_catch_parameter.
(complete_ptr_ref_or_void_ptr_p): Add a tsubst_flags_t parameter.
Use
it. Return bool. Call complete_type_or_maybe_complain instead of
complete_type_or_else.
(is_admissible_throw_operand_or_catch_parameter): Add a
tsubst_flags_t
parameter. Use it. Guard error calls.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/concepts-pr112436.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/112436] SFINAE-unfriendly error on throwing pointer to incomplete type
2023-11-08 5:12 [Bug c++/112436] New: SFINAE-unfriendly error on throwing pointer to incomplete type arthur.j.odwyer at gmail dot com
` (2 preceding siblings ...)
2024-02-13 13:57 ` cvs-commit at gcc dot gnu.org
@ 2024-02-13 14:00 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-02-13 14:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112436
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed for GCC 14.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-13 14:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-08 5:12 [Bug c++/112436] New: SFINAE-unfriendly error on throwing pointer to incomplete type arthur.j.odwyer at gmail dot com
2023-11-08 5:24 ` [Bug c++/112436] " pinskia at gcc dot gnu.org
2024-02-10 15:54 ` mpolacek at gcc dot gnu.org
2024-02-13 13:57 ` cvs-commit at gcc dot gnu.org
2024-02-13 14:00 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).