PR c++/92974 - bogus location for enum and non-enum in ?: warning.
authorMarek Polacek <polacek@redhat.com>
Fri, 20 Dec 2019 23:25:44 +0000 (23:25 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Fri, 20 Dec 2019 23:25:44 +0000 (23:25 +0000)
commit97ba5b86a3c7afba4e53b84d40e056328c5ba5e0
tree964eaf4d8762968920cc5d3c6b4db538b25f48c9
parent7731b8e6f4bb44d2d1ec33072db65f2ccbf94121
PR c++/92974 - bogus location for enum and non-enum in ?: warning.

build_min_non_dep wasn't setting any location so when we were emitting the
warning in the following test while instantiating a template, its location
was UNKNOWN_LOCATION.  Rather than adding a location_t parameter, let's use
the location from the original expression.

* tree.c (build_min_non_dep): Use the location of NON_DEP when
building the expression.

* g++.dg/diagnostic/enum1.C: New test.
* g++.dg/gomp/loop-2.C: Adjust dg-error.
* g++.dg/gomp/for-21.C: Likewise.

From-SVN: r279685
gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/diagnostic/enum1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/gomp/for-21.C
gcc/testsuite/g++.dg/gomp/loop-2.C