Also fixed by r276906. Tested on x86_64-linux, applying to trunk.
2019-10-11 Marek Polacek <pola...@redhat.com> PR c++/92070 - bogus error with -fchecking=2. * g++.dg/expr/cond17.C: New test. diff --git gcc/testsuite/g++.dg/expr/cond17.C gcc/testsuite/g++.dg/expr/cond17.C new file mode 100644 index 00000000000..1999c376dd1 --- /dev/null +++ gcc/testsuite/g++.dg/expr/cond17.C @@ -0,0 +1,11 @@ +// PR c++/92070 - bogus error with -fchecking=2. +// { dg-additional-options "-fchecking=2" } + +struct a; +struct b { + static a c(); +}; +struct a : b {}; +template <class> struct d { + void e() { 0 ? b() : b::c(); } +};