OSDN Git Service

Revert "Fix PR c++/47172"
[pf3gnuchains/gcc-fork.git] / gcc / cp / semantics.c
index 161812b..58a59ee 100644 (file)
@@ -2324,7 +2324,7 @@ finish_fname (tree id)
   tree decl;
 
   decl = fname_decl (input_location, C_RID_CODE (id), id);
-  if (processing_template_decl)
+  if (processing_template_decl && current_function_decl)
     decl = DECL_NAME (decl);
   return decl;
 }
@@ -5477,6 +5477,16 @@ build_data_member_initialization (tree t, VEC(constructor_elt,gc) **vec)
     t = TREE_OPERAND (t, 0);
   if (t == error_mark_node)
     return false;
+  if (TREE_CODE (t) == STATEMENT_LIST)
+    {
+      tree_stmt_iterator i;
+      for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
+       {
+         if (! build_data_member_initialization (tsi_stmt (i), vec))
+           return false;
+       }
+      return true;
+    }
   if (TREE_CODE (t) == CLEANUP_STMT)
     {
       /* We can't see a CLEANUP_STMT in a constructor for a literal class,
@@ -5484,18 +5494,7 @@ build_data_member_initialization (tree t, VEC(constructor_elt,gc) **vec)
         ignore it; either all the initialization will be constant, in which
         case the cleanup can't run, or it can't be constexpr.
         Still recurse into CLEANUP_BODY.  */
-      t = CLEANUP_BODY (t);
-      if (TREE_CODE (t) == STATEMENT_LIST)
-       {
-         tree_stmt_iterator i;
-         for (i = tsi_start (t); !tsi_end_p (i); tsi_next (&i))
-           {
-             if (! build_data_member_initialization (tsi_stmt (i), vec))
-               return false;
-           }
-         return true;
-       }
-      return build_data_member_initialization (t, vec);
+      return build_data_member_initialization (CLEANUP_BODY (t), vec);
     }
   if (TREE_CODE (t) == CONVERT_EXPR)
     t = TREE_OPERAND (t, 0);
@@ -7264,6 +7263,7 @@ potential_constant_expression_1 (tree t, bool want_rval, tsubst_flags_t flags)
     {
     case FUNCTION_DECL:
     case BASELINK:
+    case TEMPLATE_DECL:
     case OVERLOAD:
     case TEMPLATE_ID_EXPR:
     case LABEL_DECL: