diff options
author | Jason Merrill <jason@redhat.com> | 2024-10-05 12:11:24 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2024-10-07 11:55:18 -0400 |
commit | 53f20f992a7b0f18fec83ea696c466aa53a1293c (patch) | |
tree | 4329fa2772e36b1fb2724ef18eaad5916859dcf3 /gcc | |
parent | c877a27f04f648e53c27daa252ca46d47e49b3a1 (diff) | |
download | gcc-53f20f992a7b0f18fec83ea696c466aa53a1293c.zip gcc-53f20f992a7b0f18fec83ea696c466aa53a1293c.tar.gz gcc-53f20f992a7b0f18fec83ea696c466aa53a1293c.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/decl2.cc | 17 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/auto43.C | 2 | ||||
-rw-r--r-- | 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 0279372..a0c3190 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 45a8275..19b6c47 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 de45742..b8c599c 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 "" } } |