diff mbox

Two tiny C++ cleanup PATCHes

Message ID 527162F5.9040702@redhat.com
State New
Headers show

Commit Message

Jason Merrill Oct. 30, 2013, 7:50 p.m. UTC
1) We want to skip anonymous structs when pushing member cleanups, too.
2) We shouldn't create a static variable for a compound literal in e.g. 
sizeof.

I don't think either of these will actually affect compiler output, 
they're just cleanups I noticed while working on other things.

Tested x86_64-pc-linux-gnu, applying to trunk.
diff mbox

Patch

commit d643f3c28260e0295e6ac3dd0b4d80e26b00ea3f
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Oct 22 16:33:38 2013 -0400

    	* semantics.c (finish_compound_literal): Don't create a static variable
    	inside cp_unevaluated_operand.

diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 052746c..a54123e 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2501,6 +2501,7 @@  finish_compound_literal (tree type, tree compound_literal,
   if ((!at_function_scope_p () || CP_TYPE_CONST_P (type))
       && TREE_CODE (type) == ARRAY_TYPE
       && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
+      && !cp_unevaluated_operand
       && initializer_constant_valid_p (compound_literal, type))
     {
       tree decl = create_temporary_var (type);