diff options
author | Jason Merrill <jason@redhat.com> | 2017-02-11 12:29:45 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-02-11 12:29:45 -0500 |
commit | bc61048a143b10d8efdc50195f2fc949d036ca92 (patch) | |
tree | df0e62895260012d5366675ce6bccec695312750 /gcc/cp/decl2.c | |
parent | 31deea5e716be71a07d8f1ec4670e9a074b32127 (diff) | |
download | gcc-bc61048a143b10d8efdc50195f2fc949d036ca92.zip gcc-bc61048a143b10d8efdc50195f2fc949d036ca92.tar.gz gcc-bc61048a143b10d8efdc50195f2fc949d036ca92.tar.bz2 |
PR c++/77790 - ICE with auto function in C++11 mode
* decl.c (undeduced_auto_decl): Remove C++14 limitation.
(require_deduced_type): Add complain parm, return bool.
* cp-tree.h: Adjust.
* decl2.c (mark_used): Use require_deduced_type.
From-SVN: r245358
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index cecb6a1..efc0b0e 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -5084,12 +5084,9 @@ mark_used (tree decl, tsubst_flags_t complain) || DECL_LANG_SPECIFIC (decl) == NULL || DECL_THUNK_P (decl)) { - if (!processing_template_decl && type_uses_auto (TREE_TYPE (decl))) - { - if (complain & tf_error) - error ("use of %qD before deduction of %<auto%>", decl); - return false; - } + if (!processing_template_decl + && !require_deduced_type (decl, complain)) + return false; return true; } @@ -5117,12 +5114,8 @@ mark_used (tree decl, tsubst_flags_t complain) && uses_template_parms (DECL_TI_ARGS (decl))) return true; - if (undeduced_auto_decl (decl)) - { - if (complain & tf_error) - error ("use of %qD before deduction of %<auto%>", decl); - return false; - } + if (!require_deduced_type (decl, complain)) + return false; /* If we don't need a value, then we don't need to synthesize DECL. */ if (cp_unevaluated_operand || in_discarded_stmt) |