diff options
author | Jason Merrill <jason@redhat.com> | 2023-03-16 16:55:39 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2023-04-26 21:46:00 -0400 |
commit | 95d4c0d2e6318aef88ba0bc607dfc1ec6b7a612f (patch) | |
tree | e18eb7a7de4169bc0d3216f291f41decedccebda | |
parent | 4a3dbcbdb3d2b1f0759082987135965f6a185d17 (diff) | |
download | gcc-95d4c0d2e6318aef88ba0bc607dfc1ec6b7a612f.zip gcc-95d4c0d2e6318aef88ba0bc607dfc1ec6b7a612f.tar.gz gcc-95d4c0d2e6318aef88ba0bc607dfc1ec6b7a612f.tar.bz2 |
c++: restore instantiate_decl assert
For PR61445 I removed this assert, but PR108242 demonstrated why it's still
useful; to avoid regressing the former testcase I check pattern_defined
in the assert.
This reverts r212524.
PR c++/61445
gcc/cp/ChangeLog:
* pt.cc (instantiate_decl): Assert !defer_ok for local
class members.
-rw-r--r-- | gcc/cp/pt.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 93a055c..6df16fe 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -27090,6 +27090,12 @@ instantiate_decl (tree d, bool defer_ok, bool expl_inst_class_mem_p) pattern_defined = ! DECL_EXTERNAL (code_pattern); } + /* Any local class members should be instantiated from the TAG_DEFN + with defer_ok == 0. */ + gcc_checking_assert (!defer_ok || !pattern_defined + || !decl_function_context (d) + || LAMBDA_TYPE_P (DECL_CONTEXT (d))); + /* We may be in the middle of deferred access check. Disable it now. */ push_deferring_access_checks (dk_no_deferred); |