diff options
author | Jason Merrill <jason@redhat.com> | 2008-11-18 13:11:32 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2008-11-18 13:11:32 -0500 |
commit | 3f50c84611bd118046835a42512360c40d2aa299 (patch) | |
tree | 8602d347fb3d3d55d2e49fb14e9f56ed321f7a29 /gcc/cp/decl.c | |
parent | 43db6c722af049642c4dd9e504f32cfca668c940 (diff) | |
download | gcc-3f50c84611bd118046835a42512360c40d2aa299.zip gcc-3f50c84611bd118046835a42512360c40d2aa299.tar.gz gcc-3f50c84611bd118046835a42512360c40d2aa299.tar.bz2 |
re PR c++/37962 (ICE with (auto*) casts)
PR c++/37962
cp/
* parser.c (cp_parser_type_id): Complain about auto.
* decl.c (grokdeclarator): Complain about parameters and
conversion functions declared with auto.
* call.c (standard_conversion): Use CLASS_TYPE_P instead of
MAYBE_CLASS_TYPE_P.
* cp-tree.h (TYPE_NON_AGGREGATE_CLASS): Likewise.
testsuite/
* g++.dg/cpp0x/auto[38].C: Adjust expected errors.
* g++.dg/cpp0x/auto9.C: New test.
* g++.dg/cpp0x/auto10.C: New test.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r141970
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 945b947..997c580 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8053,6 +8053,12 @@ grokdeclarator (const cp_declarator *declarator, || storage_class == sc_extern || thread_p) error ("storage class specifiers invalid in parameter declarations"); + + if (type_uses_auto (type)) + { + error ("parameter declared %<auto%>"); + type = error_mark_node; + } } /* Give error if `virtual' is used outside of class declaration. */ @@ -8246,23 +8252,29 @@ grokdeclarator (const cp_declarator *declarator, { if (type_uses_auto (type)) { - if (!declarator->u.function.late_return_type) + if (sfk == sfk_conversion) + { + error ("invalid use of %<auto%> in conversion operator"); + return error_mark_node; + } + else if (!declarator->u.function.late_return_type) { - error ("%qs function uses auto type specifier without" + error ("%qs function uses %<auto%> type specifier without" " late return type", name); return error_mark_node; } else if (!is_auto (type)) { - error ("%qs function with late return type not using" - " auto type specifier as its type", name); + error ("%qs function with late return type has" + " %qT as its type rather than plain %<auto%>", + name, type); return error_mark_node; } } else if (declarator->u.function.late_return_type) { error ("%qs function with late return type not declared" - " with auto type specifier", name); + " with %<auto%> type specifier", name); return error_mark_node; } } |