mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-01-19 13:04:59 +08:00
re PR c++/41997 ([C++0x] constant initializer_list not optimised)
PR c++/41997 * semantics.c (finish_compound_literal): Use cp_apply_type_quals_to_decl when creating a static variable. From-SVN: r156760
This commit is contained in:
parent
912eb5a4de
commit
1acb8caa79
@ -1,3 +1,9 @@
|
||||
2010-02-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/41997
|
||||
* semantics.c (finish_compound_literal): Use
|
||||
cp_apply_type_quals_to_decl when creating a static variable.
|
||||
|
||||
2010-02-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/43024
|
||||
|
@ -2257,6 +2257,7 @@ finish_compound_literal (tree type, tree compound_literal)
|
||||
tree decl = create_temporary_var (type);
|
||||
DECL_INITIAL (decl) = compound_literal;
|
||||
TREE_STATIC (decl) = 1;
|
||||
cp_apply_type_quals_to_decl (cp_type_quals (type), decl);
|
||||
decl = pushdecl_top_level (decl);
|
||||
DECL_NAME (decl) = make_anon_name ();
|
||||
SET_DECL_ASSEMBLER_NAME (decl, DECL_NAME (decl));
|
||||
|
@ -1,3 +1,8 @@
|
||||
2010-02-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/41997
|
||||
* g++.dg/cpp0x/initlist-opt.C: New.
|
||||
|
||||
2010-02-13 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/41113
|
||||
|
19
gcc/testsuite/g++.dg/cpp0x/initlist-opt.C
Normal file
19
gcc/testsuite/g++.dg/cpp0x/initlist-opt.C
Normal file
@ -0,0 +1,19 @@
|
||||
// PR c++/41997
|
||||
// { dg-options "-std=c++0x -O2 -fdump-tree-optimized" }
|
||||
// { dg-final { scan-tree-dump-not "_0" "optimized" } }
|
||||
// { dg-final { cleanup-tree-dump "optimized" } }
|
||||
|
||||
#include <initializer_list>
|
||||
|
||||
int max_val(std::initializer_list<int> il)
|
||||
{
|
||||
int i = *(il.begin());
|
||||
int j = *(il.begin() + 1);
|
||||
return (i > j ? i : j);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return max_val({1,2});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user