diff options
author | Paolo Carlini <paolo@gcc.gnu.org> | 2011-11-10 02:27:16 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2011-11-10 02:27:16 +0000 |
commit | 136a1c15d70712b65429ca8028fb2fe2d38df501 (patch) | |
tree | 82f3953d64b0c335c589440e58ddeb6dba44ac21 | |
parent | 430616e7a7a321e216aeaeccc3da35aa23c0080f (diff) | |
download | gcc-136a1c15d70712b65429ca8028fb2fe2d38df501.zip gcc-136a1c15d70712b65429ca8028fb2fe2d38df501.tar.gz gcc-136a1c15d70712b65429ca8028fb2fe2d38df501.tar.bz2 |
re PR c++/50837 ([c++0x] static_assert and constexpr in template class)
/cp
2011-11-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50837
* pt.c (tsubst_copy_and_build) [IDENTIFIER_NODE]: In C++11 mode
pass allow_non_integral_constant_expression_p = true to
finish_id_expression.
/testsuite
2011-11-09 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50837
* g++.dg/cpp0x/static_assert5.C: New.
* g++.dg/template/nontype13.C: Tweak.
From-SVN: r181248
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/static_assert5.C | 21 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/nontype13.C | 2 |
5 files changed, 37 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 406f77c..33bfa33 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2011-11-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/50837 + * pt.c (tsubst_copy_and_build) [IDENTIFIER_NODE]: In C++11 mode + pass allow_non_integral_constant_expression_p = true to + finish_id_expression. + 2011-11-09 Jason Merrill <jason@redhat.com> PR c++/50972 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 55eba5a..da5497e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13233,7 +13233,7 @@ tsubst_copy_and_build (tree t, decl = finish_id_expression (t, decl, NULL_TREE, &idk, integral_constant_expression_p, - /*allow_non_integral_constant_expression_p=*/false, + /*allow_non_integral_constant_expression_p=*/(cxx_dialect >= cxx0x), &non_integral_constant_expression_p, /*template_p=*/false, /*done=*/true, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f71e67..c5004a4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-11-09 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/50837 + * g++.dg/cpp0x/static_assert5.C: New. + * g++.dg/template/nontype13.C: Tweak. + 2011-11-09 Jason Merrill <jason@redhat.com> PR c++/50972 @@ -25,7 +31,7 @@ 2011-11-09 Patrick Marlier <patrick.marlier@gmail.com> - * gcc.dg/tm/memopt-1.c: Adjust regexp. + * gcc.dg/tm/memopt-1.c: Adjust regexp. 2011-11-09 Jason Merrill <jason@redhat.com> diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert5.C b/gcc/testsuite/g++.dg/cpp0x/static_assert5.C new file mode 100644 index 0000000..b918796 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert5.C @@ -0,0 +1,21 @@ +// PR c++/50837 +// { dg-options "-std=c++0x" } + +template<class T> +struct z +{ + static constexpr bool test_constexpr() + { + return true; + } + + static void test() + { + static_assert(test_constexpr(), "test1"); + } +}; + +int main() +{ + z<int>::test(); +} diff --git a/gcc/testsuite/g++.dg/template/nontype13.C b/gcc/testsuite/g++.dg/template/nontype13.C index 4b3e862..d604da9 100644 --- a/gcc/testsuite/g++.dg/template/nontype13.C +++ b/gcc/testsuite/g++.dg/template/nontype13.C @@ -11,7 +11,7 @@ struct Dummy template<bool B> void tester() { - bar<evil>()(); // { dg-error "constant" } + bar<evil>()(); // { dg-error "constant|template" } } template<bool B> struct bar |