diff options
author | Nathan Sidwell <nathan@acm.org> | 2020-11-03 10:21:20 -0800 |
---|---|---|
committer | Nathan Sidwell <nathan@acm.org> | 2020-11-03 10:23:44 -0800 |
commit | a52bf016433154c61d1cab3fd3d9e17b1bb330f0 (patch) | |
tree | f64e81fbc14e1281a6d9b10e41f1cdde525840a7 | |
parent | 78f2f08ac8f22a0ad412a2abf5225b5fe3176bcf (diff) | |
download | gcc-a52bf016433154c61d1cab3fd3d9e17b1bb330f0.zip gcc-a52bf016433154c61d1cab3fd3d9e17b1bb330f0.tar.gz gcc-a52bf016433154c61d1cab3fd3d9e17b1bb330f0.tar.bz2 |
c++: using-decl instantiation
In streaming using decls I needed to check some assumptions. This
adds those checks to the instantiation machinery.
gcc/cp/
* pt.c (tsubst_expr): Simplify using decl instantiation, add
asserts.
-rw-r--r-- | gcc/cp/pt.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 388423b..b782fb5 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18058,11 +18058,18 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, finish_label_decl (DECL_NAME (decl)); else if (TREE_CODE (decl) == USING_DECL) { + /* We cannot have a member-using decl here (until 'using + enum T' is a thing). */ + gcc_checking_assert (!DECL_DEPENDENT_P (decl)); + + /* This must be a non-dependent using-decl, and we'll have + used the names it found during template parsing. We do + not want to do the lookup again, because we might not + find the things we found then. (Again, using enum T + might mean we have to do things here.) */ tree scope = USING_DECL_SCOPE (decl); - tree name = DECL_NAME (decl); - - scope = tsubst (scope, args, complain, in_decl); - finish_nonmember_using_decl (scope, name); + gcc_checking_assert (scope + == tsubst (scope, args, complain, in_decl)); } else if (is_capture_proxy (decl) && !DECL_TEMPLATE_INSTANTIATION (current_function_decl)) |