2011-05-25 Jason Merrill <jason@redhat.com>
+ PR c++/46245
+ * decl.c (grokdeclarator): Complain later for auto parameter.
+ * pt.c (splice_late_return_type): Handle use in a template
+ type-parameter.
+
PR c++/46696
* typeck.c (cp_build_modify_expr): Check DECL_DEFAULTED_FN.
|| thread_p)
error ("storage class specifiers invalid in parameter declarations");
- if (type_uses_auto (type))
- {
- error ("parameter declared %<auto%>");
- type = error_mark_node;
- }
-
/* Function parameters cannot be constexpr. If we saw one, moan
and pretend it wasn't there. */
if (constexpr_p)
if (ctype || in_namespace)
error ("cannot use %<::%> in parameter declaration");
+ if (type_uses_auto (type))
+ {
+ error ("parameter declared %<auto%>");
+ type = error_mark_node;
+ }
+
/* A parameter declared as an array of T is really a pointer to T.
One declared as a function is really a pointer to a function.
One declared as a member is really a pointer to member. */
return type;
argvec = make_tree_vec (1);
TREE_VEC_ELT (argvec, 0) = late_return_type;
- if (processing_template_decl)
+ if (processing_template_parmlist)
+ /* For a late-specified return type in a template type-parameter, we
+ need to add a dummy argument level for its parmlist. */
+ argvec = add_to_template_args
+ (make_tree_vec (processing_template_parmlist), argvec);
+ if (current_template_parms)
argvec = add_to_template_args (current_template_args (), argvec);
return tsubst (type, argvec, tf_warning_or_error, NULL_TREE);
}
2011-05-25 Jason Merrill <jason@redhat.com>
+ * g++.dg/cpp0x/auto23.C: New.
+ * g++.dg/cpp0x/auto9.C: Adjust.
+
* g++.dg/cpp0x/defaulted29.C: New.
* g++.dg/cpp0x/initlist51.C: New.
--- /dev/null
+// PR c++/46245
+// { dg-options -std=c++0x }
+
+template<auto f()->int> struct A { };
void
bar ()
{
- try { } catch (auto i) { } // { dg-error "invalid use of" }
- try { } catch (auto) { } // { dg-error "invalid use of" }
- try { } catch (auto *i) { } // { dg-error "invalid use of" }
- try { } catch (auto *) { } // { dg-error "invalid use of" }
+ try { } catch (auto i) { } // { dg-error "parameter declared" }
+ try { } catch (auto) { } // { dg-error "parameter declared" }
+ try { } catch (auto *i) { } // { dg-error "parameter declared" }
+ try { } catch (auto *) { } // { dg-error "parameter declared" }
}
void