https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92974
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> --- Author: mpolacek Date: Fri Dec 20 23:25:44 2019 New Revision: 279685 URL: https://gcc.gnu.org/viewcvs?rev=279685&root=gcc&view=rev Log: 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. Added: trunk/gcc/testsuite/g++.dg/diagnostic/enum1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/tree.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/gomp/for-21.C trunk/gcc/testsuite/g++.dg/gomp/loop-2.C