From: Paolo Carlini Date: Thu, 10 Nov 2011 02:27:16 +0000 (+0000) Subject: re PR c++/50837 ([c++0x] static_assert and constexpr in template class) X-Git-Tag: releases/gcc-4.7.0~2278 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=136a1c15d70712b65429ca8028fb2fe2d38df501;p=thirdparty%2Fgcc.git re PR c++/50837 ([c++0x] static_assert and constexpr in template class) /cp 2011-11-09 Paolo Carlini 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 PR c++/50837 * g++.dg/cpp0x/static_assert5.C: New. * g++.dg/template/nontype13.C: Tweak. From-SVN: r181248 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 406f77c72665..33bfa33403df 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2011-11-09 Paolo Carlini + + 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 PR c++/50972 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 55eba5a0910a..da5497ea5c75 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 0f71e6773a3c..c5004a413909 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-11-09 Paolo Carlini + + PR c++/50837 + * g++.dg/cpp0x/static_assert5.C: New. + * g++.dg/template/nontype13.C: Tweak. + 2011-11-09 Jason Merrill PR c++/50972 @@ -25,7 +31,7 @@ 2011-11-09 Patrick Marlier - * gcc.dg/tm/memopt-1.c: Adjust regexp. + * gcc.dg/tm/memopt-1.c: Adjust regexp. 2011-11-09 Jason Merrill 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 000000000000..b918796220cc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/static_assert5.C @@ -0,0 +1,21 @@ +// PR c++/50837 +// { dg-options "-std=c++0x" } + +template +struct z +{ + static constexpr bool test_constexpr() + { + return true; + } + + static void test() + { + static_assert(test_constexpr(), "test1"); + } +}; + +int main() +{ + z::test(); +} diff --git a/gcc/testsuite/g++.dg/template/nontype13.C b/gcc/testsuite/g++.dg/template/nontype13.C index 4b3e862ba800..d604da944541 100644 --- a/gcc/testsuite/g++.dg/template/nontype13.C +++ b/gcc/testsuite/g++.dg/template/nontype13.C @@ -11,7 +11,7 @@ struct Dummy template void tester() { - bar()(); // { dg-error "constant" } + bar()(); // { dg-error "constant|template" } } template struct bar