Go to file
Marek Polacek 1e89178889 c++: ICE in value_dependent_expression_p in C++98 mode [PR94938]
Here we ICE with -std=c++98 since the newly added call to uses_template_parms
(r10-6357): we hit
26530             gcc_assert (cxx_dialect >= cxx11
26531                         || INTEGRAL_OR_ENUMERATION_TYPE_P (type));
and TYPE is a record type.  The problem is that the argument to
value_dependent_expression_p does not satisfy potential_constant_expression
which it must, as the comment explains.  I thought about fixing this in
uses_template_parms -- only call v_d_e_p if p_c_e is true, but in this
case we want to also suppress the warnings if we don't have a constant
expression.  I couldn't simply check TREE_CONSTANT as in
compute_array_index_type_loc, because then we'd stop warning in the new
Wtype-limits3.C test.

Fixed by using type_dependent_expression_p_push instead.  This means
that we won't suppress the warnings for value-dependent expressions that
aren't type-dependent, e.g. sizeof (T).  This only seems to make a
difference for -Wdiv-by-zero, now tested in Wdiv-by-zero-3.C, where I
think it's reasonable to warn.  It could make -Wtautological-compare
warn more, but that warning doesn't trigger when it gets constant arguments.
Wtype-limits4.C is a test reduced from poly-int.h and it tests a scenario
that was missing in our testsuite.

This patch also moves the warning_sentinels after the RECURs -- we mean
to use them for build_x_binary_op purposes only.

	PR c++/94938
	* pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
	instead of uses_template_parms.  Move the warning_sentinels after the
	RECURs.

	* g++.dg/warn/Wdiv-by-zero-3.C: New test.
	* g++.dg/warn/Wtype-limits4.C: New test.
	* g++.dg/warn/template-2.C: New test.
	* g++.old-deja/g++.pt/crash10.C: Add dg-warning.
2020-05-06 18:52:44 -04:00
config
contrib
fixincludes
gcc c++: ICE in value_dependent_expression_p in C++98 mode [PR94938] 2020-05-06 18:52:44 -04:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic i386: Use generic division to generate INEXACT exception 2020-05-06 23:01:32 +02:00
libbacktrace
libcc1
libcpp
libdecnumber
libffi
libgcc i386: Use generic division to generate INEXACT exception 2020-05-06 23:01:32 +02:00
libgfortran i386: Use generic division to generate INEXACT exception 2020-05-06 23:01:32 +02:00
libgo
libgomp
libhsail-rt
libiberty
libitm libitm: Disable diagnostic coloring in tests 2020-05-05 12:50:54 -07:00
libobjc
liboffloadmic Add missing ChangeLog entries. 2020-05-05 16:10:13 +02:00
libphobos
libquadmath
libsanitizer
libssp
libstdc++-v3 libstdc++ std::fill overload for std::vector<bool>::iterator 2020-05-06 23:28:22 +02:00
libvtv
lto-plugin Silence warning in LTO mode on VxWorks 2020-05-05 12:42:22 +02:00
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog
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
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
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.