Go to file
Jakub Jelinek cfed80b9e4 c++: Fix up maybe_warn_for_constant_evaluated calls [PR114580]
When looking at maybe_warn_for_constant_evaluated for the trivial
infinite loops patch, I've noticed that it can emit weird diagnostics
for if constexpr in templates, first warn that std::is_constant_evaluted()
always evaluates to false (because the function template is not constexpr)
and then during instantiation warn that std::is_constant_evaluted()
always evaluates to true (because it is used in if constexpr condition).
Now, only the latter is actually true, even when the if constexpr
is in a non-constexpr function, it will still always evaluate to true.

So, the following patch fixes it to call maybe_warn_for_constant_evaluated
always with IF_STMT_CONSTEXPR_P (if_stmt) as the second argument rather than
true if it is if constexpr with non-dependent condition etc.

2024-04-09  Jakub Jelinek  <jakub@redhat.com>

	PR c++/114580
	* semantics.cc (finish_if_stmt_cond): Call
	maybe_warn_for_constant_evaluated with IF_STMT_CONSTEXPR_P (if_stmt)
	as the second argument, rather than true/false depending on if
	it is if constexpr with non-dependent constant expression with
	bool type.

	* g++.dg/cpp2a/is-constant-evaluated15.C: New test.
2024-04-09 09:31:42 +02:00
.github
c++tools
config Daily bump. 2024-04-03 00:17:29 +00:00
contrib Daily bump. 2024-04-08 12:15:19 +00:00
fixincludes
gcc c++: Fix up maybe_warn_for_constant_evaluated calls [PR114580] 2024-04-09 09:31:42 +02:00
gnattools
gotools
include Daily bump. 2024-04-09 00:17:24 +00:00
INSTALL
libada
libatomic Daily bump. 2024-04-08 12:15:19 +00:00
libbacktrace
libcc1
libcody
libcpp
libdecnumber Daily bump. 2024-04-03 00:17:29 +00:00
libffi
libgcc libgcc: Add basic support for aarch64-gnu (GNU/Hurd on AArch64) 2024-04-09 09:23:33 +02:00
libgfortran Daily bump. 2024-04-09 00:17:24 +00:00
libgm2 Daily bump. 2024-04-03 00:17:29 +00:00
libgo
libgomp Daily bump. 2024-04-09 00:17:24 +00:00
libgrust
libiberty Daily bump. 2024-04-03 00:17:29 +00:00
libitm Daily bump. 2024-04-03 00:17:29 +00:00
libobjc Daily bump. 2024-04-03 00:17:29 +00:00
libphobos Daily bump. 2024-04-08 12:15:19 +00:00
libquadmath libquadmath: Use soft-fp for sqrtq finite positive arguments [PR114623] 2024-04-09 08:17:25 +02:00
libsanitizer
libssp
libstdc++-v3 Daily bump. 2024-04-09 00:17:24 +00:00
libvtv Daily bump. 2024-04-03 00:17:29 +00:00
lto-plugin
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2024-04-05 00:16:44 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Update my email address 2024-04-04 16:39:52 +02:00
Makefile.def
Makefile.in Fix up postboot dependencies [PR106472] 2024-04-02 13:40:27 +02:00
Makefile.tpl Fix up postboot dependencies [PR106472] 2024-04-02 13:40:27 +02:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
SECURITY.txt
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.