diff options
author | Jason Merrill <jason@redhat.com> | 2011-04-21 00:28:32 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-04-21 00:28:32 -0400 |
commit | fa9ef321070b9fbedf735ee8fdf864aa7c2b80f5 (patch) | |
tree | d058988cd03513ec16404b8d12359319b2cdfc87 /gcc | |
parent | f70292772476f1ccc341a69bfb0ab264bc9954bf (diff) | |
download | gcc-fa9ef321070b9fbedf735ee8fdf864aa7c2b80f5.zip gcc-fa9ef321070b9fbedf735ee8fdf864aa7c2b80f5.tar.gz gcc-fa9ef321070b9fbedf735ee8fdf864aa7c2b80f5.tar.bz2 |
semantics.c (finish_compound_literal): Don't put an array with a dtor in a static variable.
* semantics.c (finish_compound_literal): Don't put an array
with a dtor in a static variable.
From-SVN: r172810
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/initlist47.C | 9 |
4 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dcfa7e6..965ee6e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-04-20 Jason Merrill <jason@redhat.com> + * semantics.c (finish_compound_literal): Don't put an array + with a dtor in a static variable. + * call.c (build_over_call): Handle trivial dtor. * search.c (lookup_fnfields_slot): Call complete_type. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index e9b1907..7763ae00 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -2383,6 +2383,7 @@ finish_compound_literal (tree type, tree compound_literal, represent class temporaries with TARGET_EXPR so we elide copies. */ if ((!at_function_scope_p () || CP_TYPE_CONST_P (type)) && TREE_CODE (type) == ARRAY_TYPE + && !TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type) && initializer_constant_valid_p (compound_literal, type)) { tree decl = create_temporary_var (type); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8fd0216..07a0a6b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,7 @@ 2011-04-20 Jason Merrill <jason@redhat.com> + * g++.dg/cpp0x/initlist47.C: New. + * g++.dg/init/dtor4.C: New. 2011-04-20 Uros Bizjak <ubizjak@gmail.com> diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist47.C b/gcc/testsuite/g++.dg/cpp0x/initlist47.C new file mode 100644 index 0000000..b76fb58 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/initlist47.C @@ -0,0 +1,9 @@ +// { dg-options -std=c++0x } + +struct A { ~A() = delete; }; // { dg-error "declared" } + +int main() +{ + typedef const A cA[2]; + cA{}; // { dg-error "deleted" } +} |