commit 761bc243b609db7b75f71f465812e0491212d63b
Author: Jason Merrill <jason@redhat.com>
Date: Fri May 17 16:06:04 2013 -0400
PR c++/57317
* decl2.c (determine_visibility): Use PRIMARY_TEMPLATE_P to decide
whether a template has its own args.
@@ -2213,9 +2213,6 @@ determine_visibility (tree decl)
&& !lookup_attribute ("visibility", attribs))
{
int depth = TMPL_ARGS_DEPTH (args);
- int class_depth = 0;
- if (class_type && CLASSTYPE_TEMPLATE_INFO (class_type))
- class_depth = TMPL_ARGS_DEPTH (CLASSTYPE_TI_ARGS (class_type));
if (DECL_VISIBILITY_SPECIFIED (decl))
{
/* A class template member with explicit visibility
@@ -2228,7 +2225,7 @@ determine_visibility (tree decl)
constrain_visibility_for_template (decl, lev);
}
}
- else if (depth > class_depth)
+ else if (PRIMARY_TEMPLATE_P (TI_TEMPLATE (tinfo)))
/* Limit visibility based on its template arguments. */
constrain_visibility_for_template (decl, args);
}
new file mode 100644
@@ -0,0 +1,12 @@
+// PR c++/57137
+
+#include "anonymous-namespace-4.h"
+
+namespace
+{
+ class NonCloneable;
+ void fn1 ()
+ {
+ is_function_impl < NonCloneable > i;
+ }
+}
new file mode 100644
@@ -0,0 +1,14 @@
+template < typename T > struct integral_c {
+ static const T value = 0;
+};
+struct is_reference:integral_c < bool > { };
+template < class > struct is_function_ptr_helper { };
+template < bool > struct is_function_chooser;
+
+template <> struct is_function_chooser <0 >
+{
+ template < typename T > struct result_:is_function_ptr_helper < T * > { };
+};
+
+template < typename T > struct is_function_impl:is_function_chooser <
+ is_reference::value >::result_ < T > { };