aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-01-22 17:41:48 -0500
committerJason Merrill <jason@gcc.gnu.org>2018-01-22 17:41:48 -0500
commitc3b56023072707b09634953e4c4021e604896f2f (patch)
tree72fb698443b08a780bf06630932d53f10017bf2c /gcc
parent1fcaa1eb87540b689b435914a0d82bc9b65bcc34 (diff)
downloadgcc-c3b56023072707b09634953e4c4021e604896f2f.zip
gcc-c3b56023072707b09634953e4c4021e604896f2f.tar.gz
gcc-c3b56023072707b09634953e4c4021e604896f2f.tar.bz2
PR c++/83720 - different fix
* decl2.c (determine_visibility): Fix template_decl handling instead of blocking it. From-SVN: r256965
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/decl2.c11
2 files changed, 9 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 8ec76a4..004d234 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2018-01-22 Jason Merrill <jason@redhat.com>
+ PR c++/83720
+ * decl2.c (determine_visibility): Fix template_decl handling
+ instead of blocking it.
+
PR c++/83720 - ICE with lambda and LTO.
* decl2.c (determine_visibility): Clear template_decl for
function-scope decls. Propagate anonymous linkage from containing
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 6324c55..ef7e6de 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2388,9 +2388,7 @@ determine_visibility (tree decl)
containing function by default, except that
-fvisibility-inlines-hidden doesn't affect them. */
tree fn = DECL_CONTEXT (decl);
- if (! TREE_PUBLIC (fn))
- constrain_visibility (decl, VISIBILITY_ANON, false);
- else if (DECL_VISIBILITY_SPECIFIED (fn))
+ if (DECL_VISIBILITY_SPECIFIED (fn))
{
DECL_VISIBILITY (decl) = DECL_VISIBILITY (fn);
DECL_VISIBILITY_SPECIFIED (decl) =
@@ -2416,9 +2414,10 @@ determine_visibility (tree decl)
/* Local classes in templates have CLASSTYPE_USE_TEMPLATE set,
but have no TEMPLATE_INFO. Their containing template
- function determines their visibility, so we neither
- need nor want the template_decl handling. */
- template_decl = NULL_TREE;
+ 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 (VAR_P (decl) && DECL_TINFO_P (decl)
&& flag_visibility_ms_compat)