aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-05-07 19:50:16 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-05-07 19:50:16 -0400
commit6b83a3c6e3b408a00a0fb326828571770706ec24 (patch)
tree5abd16b134266c0d742ad5afcdeb2cfbfcc27a82 /gcc/cp
parentee336e846de46aa5523a96f712d247c31a07c6e1 (diff)
downloadgcc-6b83a3c6e3b408a00a0fb326828571770706ec24.zip
gcc-6b83a3c6e3b408a00a0fb326828571770706ec24.tar.gz
gcc-6b83a3c6e3b408a00a0fb326828571770706ec24.tar.bz2
PR c++/85646 - lambda visibility.
* decl2.c (determine_visibility): Don't mess with template arguments from the containing scope. (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor thunk. From-SVN: r260017
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl2.c24
2 files changed, 15 insertions, 17 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 75f5207..6599115 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+2018-05-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/85646 - lambda visibility.
+ * decl2.c (determine_visibility): Don't mess with template arguments
+ from the containing scope.
+ (vague_linkage_p): Check DECL_ABSTRACT_P before looking at a 'tor
+ thunk.
+
2018-05-07 Nathan Sidwell <nathan@acm.org>
Remove fno-for-scope
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index b0bf824..9aae34a 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1939,10 +1939,13 @@ vague_linkage_p (tree decl)
{
if (!TREE_PUBLIC (decl))
{
- /* maybe_thunk_body clears TREE_PUBLIC on the maybe-in-charge 'tor
- variants, check one of the "clones" for the real linkage. */
+ /* maybe_thunk_body clears TREE_PUBLIC and DECL_ABSTRACT_P on the
+ maybe-in-charge 'tor variants; in that case we need to check one of
+ the "clones" for the real linkage. But only in that case; before
+ maybe_clone_body we haven't yet copied the linkage to the clones. */
if ((DECL_MAYBE_IN_CHARGE_DESTRUCTOR_P (decl)
|| DECL_MAYBE_IN_CHARGE_CONSTRUCTOR_P (decl))
+ && !DECL_ABSTRACT_P (decl)
&& DECL_CHAIN (decl)
&& DECL_CLONED_FUNCTION_P (DECL_CHAIN (decl)))
return vague_linkage_p (DECL_CHAIN (decl));
@@ -2422,21 +2425,8 @@ determine_visibility (tree decl)
}
/* Local classes in templates have CLASSTYPE_USE_TEMPLATE set,
- but have no TEMPLATE_INFO. Their containing template
- function does, and the local class could be constrained
- by that. */
- if (DECL_LANG_SPECIFIC (fn) && DECL_USE_TEMPLATE (fn))
- template_decl = fn;
- else if (template_decl)
- {
- /* FN must be a regenerated lambda function, since they don't
- have template arguments. Find a containing non-lambda
- template instantiation. */
- tree ctx = fn;
- while (ctx && !get_template_info (ctx))
- ctx = get_containing_scope (ctx);
- template_decl = ctx;
- }
+ but have no TEMPLATE_INFO, so don't try to check it. */
+ template_decl = NULL_TREE;
}
else if (VAR_P (decl) && DECL_TINFO_P (decl)
&& flag_visibility_ms_compat)