https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57943
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:115232b778943be075fc4df991e03d9387563114 commit r11-434-g115232b778943be075fc4df991e03d9387563114 Author: Patrick Palka <ppa...@redhat.com> Date: Fri May 15 18:51:11 2020 -0400 c++: decltype of invalid non-dependent expr [PR57943] We sometimes fail to reject an invalid non-dependent operand to decltype when inside a template, because finish_decltype_type resolves the decltype to the TREE_TYPE of the operand before we ever instantiate and fully process the operand. Fix this by adding a call to instantiate_non_dependent_expr_sfinae in finish_decltype_type. gcc/cp/ChangeLog: PR c++/57943 * semantics.c (finish_decltype_type): Call instantiate_non_dependent_expr_sfinae on the expression. gcc/testsuite/ChangeLog: PR c++/57943 * g++.dg/cpp0x/decltype76.C: New test.