pt.c (tsubst_decl): In unevaluated operand, don't tsubst DECL_INITIAL unless our...
authorJason Merrill <jason@redhat.com>
Wed, 29 Jun 2011 21:19:22 +0000 (17:19 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 29 Jun 2011 21:19:22 +0000 (17:19 -0400)
* pt.c (tsubst_decl) [VAR_DECL]: In unevaluated operand,
don't tsubst DECL_INITIAL unless our type use auto.

From-SVN: r175670

gcc/cp/ChangeLog
gcc/cp/pt.c

index 858ad8414d57ea3d0517f5ebb993f77e98c50422..f06c257796f5471e90d68228bb1c5bada825259c 100644 (file)
@@ -1,5 +1,8 @@
 2011-06-29  Jason Merrill  <jason@redhat.com>
 
+       * pt.c (tsubst_decl) [VAR_DECL]: In unevaluated operand,
+       don't tsubst DECL_INITIAL unless our type use auto.
+
        PR c++/49520
        * semantics.c (constexpr_fn_retval): Handle CLEANUP_POINT_EXPR here.
        (massage_constexpr_body): Not here.
index d1d8336b1bd747d52c1721b1d7ca41ca0a8b9d70..dc6cd5086d53e4ec39c164e7280970fe3315ce31 100644 (file)
@@ -10138,12 +10138,11 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
               scope, such as for a lambda return type.  Don't add it to
               local_specializations, do perform auto deduction.  */
            tree auto_node = type_uses_auto (type);
-           tree init
-             = tsubst_expr (DECL_INITIAL (t), args, complain, in_decl,
-                            /*constant_expression_p=*/false);
-
-           if (auto_node && init)
+           if (auto_node)
              {
+               tree init
+                 = tsubst_expr (DECL_INITIAL (t), args, complain, in_decl,
+                                /*constant_expression_p=*/false);
                init = resolve_nondeduced_context (init);
                TREE_TYPE (r) = type
                  = do_auto_deduction (type, init, auto_node);