1 Upstream-Status: Inappropriate [Backport]
2 From 19692feb0bd83e8e6b3a1e1e0b43119d7e12ce96 Mon Sep 17 00:00:00 2001
3 From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
4 Date: Thu, 21 Apr 2011 04:27:30 +0000
5 Subject: [PATCH 160/200] * semantics.c (finish_compound_literal): Don't put an array
6 with a dtor in a static variable.
8 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@172806 138bc75d-0d04-0410-961f-82ee72b054a4
10 index cf8d329..0d80771 100644
11 --- a/gcc/cp/semantics.c
12 +++ b/gcc/cp/semantics.c
13 @@ -2333,6 +2333,7 @@ finish_compound_literal (tree type, tree compound_literal)
14 represent class temporaries with TARGET_EXPR so we elide copies. */
15 if ((!at_function_scope_p () || CP_TYPE_CONST_P (type))
16 && TREE_CODE (type) == ARRAY_TYPE
17 + && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type)
18 && initializer_constant_valid_p (compound_literal, type))
20 tree decl = create_temporary_var (type);
22 index 0000000..b76fb58
24 +++ b/gcc/testsuite/g++.dg/cpp0x/initlist47.C
26 +// { dg-options -std=c++0x }
28 +struct A { ~A() = delete; }; // { dg-error "declared" }
32 + typedef const A cA[2];
33 + cA{}; // { dg-error "deleted" }