commit 8b9688d5cdf39fb306257ea0d02a7e4239179913
Author: Jason Merrill <jason@redhat.com>
Date: Sun May 22 15:54:43 2011 -0400
PR c++/47336
* error.c (dump_template_bindings): Suppress access control.
@@ -313,7 +313,9 @@ dump_template_bindings (tree parms, tree args, VEC(tree,gc)* typenames)
pp_cxx_whitespace (cxx_pp);
pp_equal (cxx_pp);
pp_cxx_whitespace (cxx_pp);
+ push_deferring_access_checks (dk_no_check);
t = tsubst (t, args, tf_none, NULL_TREE);
+ pop_deferring_access_checks ();
/* Strip typedefs. We can't just use TFF_CHASE_TYPEDEF because
pp_simple_type_specifier doesn't know about it. */
t = strip_typedefs (t);
new file mode 100644
@@ -0,0 +1,24 @@
+// PR c++/47336
+// { dg-options -std=c++0x }
+
+template <typename T>
+void g(T t)
+{
+ t+1; // { dg-error "no match" }
+}
+
+template <typename S>
+class C
+{
+ struct D {} d;
+public:
+ decltype(g(d)) h()
+ {
+ return g(d);
+ }
+};
+
+int main()
+{
+ C<int>().h();
+}