[Bug d/123995] d: error: using result of function returning void with assert(0)

2026-02-08 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123995

Iain Buclaw  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|UNCONFIRMED |RESOLVED

--- Comment #3 from Iain Buclaw  ---
Fixed.

[Bug d/123995] d: error: using result of function returning void with assert(0)

2026-02-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123995

--- Comment #2 from GCC Commits  ---
The master branch has been updated by Iain Buclaw :

https://gcc.gnu.org/g:815732c2751060c38f0dc872a025632f247dda5c

commit r16-7397-g815732c2751060c38f0dc872a025632f247dda5c
Author: Iain Buclaw 
Date:   Sun Feb 8 18:31:50 2026 +0100

d: Fix error when passing assert(0) as argument [PR123995]

Library routines that either throw or halt execution already have the
call flag ECF_NORETURN.  Make their internal type `noreturn' as well, so
that they can be "passed" to functions accepting noreturn arguments.

PR d/123995

gcc/d/ChangeLog:

* d-codegen.cc (build_assert_call): Cast libcall result to
`noreturn'.
(build_array_bounds_call):  Likewise.
(build_bounds_index_condition): Likewise.
(build_bounds_slice_condition): Likewise.
* expr.cc (ExprVisitor::visit (ThrowExp *)): Likewise.
* toir.cc (IRVisitor::visit (ThrowStatement *)): Likewise.
* runtime.cc (enum d_libcall_type): Add LCT_NORETURN.
(get_libcall_type): Handle LCT_NORETURN.
* runtime.def (ASSERTP): Change return type to `noreturn'.
(ASSERT_MSG): Likewise.
(UNITTESTP): Likewise.
(UNITTEST_MSG): Likewise.
(ARRAYBOUNDSP): Likewise.
(ARRAYBOUNDS_SLICEP): Likewise.
(ARRAYBOUNDS_INDEXP): Likewise.
(THROW): Likewise.

gcc/testsuite/ChangeLog:

* gdc.dg/pr123995.d: New test.

[Bug d/123995] d: error: using result of function returning void with assert(0)

2026-02-05 Thread ibuclaw at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123995

--- Comment #1 from Iain Buclaw  ---
The libcall is still typed `void`, even though `typeof(*null)` (aka noreturn)
has existed in the language for some time now.

All libcall functions that are marked ECF_NORETURN should have their return
type updated to be noreturn as well.