Commit 723889fa by Paolo Carlini Committed by Paolo Carlini

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
parent c2a45215
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
......
......@@ -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;
......
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
......
// 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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment