https://gcc.gnu.org/g:53f20f992a7b0f18fec83ea696c466aa53a1293c
commit r15-4120-g53f20f992a7b0f18fec83ea696c466aa53a1293c Author: Jason Merrill <ja...@redhat.com> Date: Sat Oct 5 12:11:24 2024 -0400 c++: require_deduced_type and modules With modules more variables have DECL_LANG_SPECIFIC, so we were failing to call require_deduced_type in constexpr-if30.C. gcc/cp/ChangeLog: * decl2.cc (mark_used): Always check require_deduced_type. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/auto43.C: Adjust diagnostic. * g++.dg/cpp2a/lambda-generic7.C: Likewise. Diff: --- gcc/cp/decl2.cc | 17 +++++++++-------- gcc/testsuite/g++.dg/cpp0x/auto43.C | 2 +- gcc/testsuite/g++.dg/cpp2a/lambda-generic7.C | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc index 0279372488c2..a0c319086d71 100644 --- a/gcc/cp/decl2.cc +++ b/gcc/cp/decl2.cc @@ -6124,19 +6124,13 @@ mark_used (tree decl, tsubst_flags_t complain /* = tf_warning_or_error */) DECL_LANG_SPECIFIC set, and these are also the only decls that we might need special handling for. */ if (!VAR_OR_FUNCTION_DECL_P (decl) - || DECL_LANG_SPECIFIC (decl) == NULL || DECL_THUNK_P (decl)) - { - if (!decl_dependent_p (decl) - && !require_deduced_type (decl, complain)) - return false; - return true; - } + return true; /* We only want to do this processing once. We don't need to keep trying to instantiate inline templates, because unit-at-a-time will make sure we get them compiled before functions that want to inline them. */ - if (DECL_ODR_USED (decl)) + if (DECL_LANG_SPECIFIC (decl) && DECL_ODR_USED (decl)) return true; if (flag_concepts && TREE_CODE (decl) == FUNCTION_DECL @@ -6164,6 +6158,13 @@ mark_used (tree decl, tsubst_flags_t complain /* = tf_warning_or_error */) && DECL_OMP_DECLARE_REDUCTION_P (decl))) maybe_instantiate_decl (decl); + if (!decl_dependent_p (decl) + && !require_deduced_type (decl, complain)) + return false; + + if (DECL_LANG_SPECIFIC (decl) == NULL) + return true; + if (processing_template_decl || in_template_context) return true; diff --git a/gcc/testsuite/g++.dg/cpp0x/auto43.C b/gcc/testsuite/g++.dg/cpp0x/auto43.C index 45a827553d06..19b6c47cf123 100644 --- a/gcc/testsuite/g++.dg/cpp0x/auto43.C +++ b/gcc/testsuite/g++.dg/cpp0x/auto43.C @@ -8,5 +8,5 @@ template<int> struct A void foo() { - A<0>().operator auto(); // { dg-error "invalid use of .auto" } + A<0>().operator auto(); // { dg-error "auto" } } diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-generic7.C b/gcc/testsuite/g++.dg/cpp2a/lambda-generic7.C index de4574205301..b8c599c11c3a 100644 --- a/gcc/testsuite/g++.dg/cpp2a/lambda-generic7.C +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-generic7.C @@ -6,5 +6,5 @@ struct S { }; template<typename T, typename U> auto foo(T, U) { - [] <> () { foo (S{}, S{}); }; // { dg-error "expected" } + [] <> () { foo (S{}, S{}); }; // { dg-error "" } }