diff options
author | Alexandre Oliva <oliva@adacore.com> | 2022-12-29 14:32:51 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2022-12-29 14:39:46 -0300 |
commit | 8251f319439ff9ae0816d31db861b8681c953fc1 (patch) | |
tree | ab2d603dee199ef66953b60f5896d298ef66c525 /gcc | |
parent | d7c8a16537aaf0fca623bf01813f5679f845edcf (diff) | |
download | gcc-8251f319439ff9ae0816d31db861b8681c953fc1.zip gcc-8251f319439ff9ae0816d31db861b8681c953fc1.tar.gz gcc-8251f319439ff9ae0816d31db861b8681c953fc1.tar.bz2 |
[C++] constraint: insert norm entry once
Use NO_INSERT to test whether inserting should be attempted.
for gcc/cp/ChangeLog
* constraint.cc (normalize_concept_check): Use NO_INSERT for
pre-insertion check.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/constraint.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 247a827..4edc084 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -777,14 +777,16 @@ normalize_concept_check (tree check, tree args, norm_info info) norm_entry entry = {tmpl, targs, NULL_TREE}; norm_entry **slot = nullptr; hashval_t hash = 0; + bool insert = false; if (!info.generate_diagnostics ()) { /* Cache the normal form of the substituted concept-id (when not diagnosing). */ hash = norm_hasher::hash (&entry); - slot = norm_cache->find_slot_with_hash (&entry, hash, INSERT); - if (*slot) + slot = norm_cache->find_slot_with_hash (&entry, hash, NO_INSERT); + if (slot) return (*slot)->norm; + insert = true; } /* The concept may have been ill-formed. */ @@ -794,7 +796,7 @@ normalize_concept_check (tree check, tree args, norm_info info) info.update_context (check, args); tree norm = normalize_expression (def, targs, info); - if (slot) + if (insert) { /* Recompute SLOT since norm_cache may have been expanded during the recursive call. */ |