re PR c++/55944 ([C++11] static local member with constexpr c'tor causes ICE)

/cp
2013-01-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55944
	* decl.c (check_initializer): Use TARGET_EXPR_DIRECT_INIT_P only
	on TARGET_EXPR nodes.

/testsuite
2013-01-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/55944
	* g++.dg/cpp0x/constexpr-static10.C: New.

From-SVN: r195391
This commit is contained in:
Paolo Carlini 2013-01-22 23:38:34 +00:00 committed by Paolo Carlini
parent c2a452151e
commit 723889fa82
4 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2013-01-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55944
* decl.c (check_initializer): Use TARGET_EXPR_DIRECT_INIT_P only
on TARGET_EXPR nodes.
2013-01-22 Jason Merrill <jason@redhat.com>
PR c++/56071

View File

@ -5693,7 +5693,7 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **cleanups)
&& (!init || TREE_CODE (init) == TREE_LIST))
{
init = build_functional_cast (type, init, tf_none);
if (init != error_mark_node)
if (TREE_CODE (init) == TARGET_EXPR)
TARGET_EXPR_DIRECT_INIT_P (init) = true;
}
init_code = NULL_TREE;

View File

@ -1,3 +1,8 @@
2013-01-22 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/55944
* g++.dg/cpp0x/constexpr-static10.C: New.
2013-01-22 Uros Bizjak <ubizjak@gmail.com>
PR target/56028

View File

@ -0,0 +1,19 @@
// PR c++/55944
// { dg-options -std=c++11 }
template<class T>
struct Test
{
constexpr Test(T val) : value(val) {}
static void test()
{
static constexpr Test<int> x(42); // ICE
}
T value;
};
int main()
{
static constexpr Test<int> x(42); // OK
Test<double>::test();
}