diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-01-22 23:38:34 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-01-22 23:38:34 +0000 |
commit | 723889fa82a7a62b78d333e20c9f203062d51e55 (patch) | |
tree | 9375b680ccf2bdab7b509e73ec50e710a7fd519a /gcc | |
parent | c2a452151e2ed203c198e8abc4ed527b0737b07f (diff) | |
download | gcc-723889fa82a7a62b78d333e20c9f203062d51e55.zip gcc-723889fa82a7a62b78d333e20c9f203062d51e55.tar.gz gcc-723889fa82a7a62b78d333e20c9f203062d51e55.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/decl.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-static10.C | 19 |
4 files changed, 31 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7da2b4a..9a25935 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 768573f..9b40018 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c0fe13b..6ed2b3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-static10.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-static10.C new file mode 100644 index 0000000..9b76e6f --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-static10.C @@ -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(); +} |