diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-08 18:09:35 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-08 18:09:35 +0000 |
commit | c2e917c391c9ca4318b4d0cd89ad84f3262518b3 (patch) | |
tree | 92fdcb27459923ecf6448b366a65496e139d9866 /gcc/cp/decl.c | |
parent | f9d4b7f4943df04e4362f7cde1fb6c6de22283ef (diff) | |
download | gcc-c2e917c391c9ca4318b4d0cd89ad84f3262518b3.tar.gz |
/cp
2013-04-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56871
* decl.c (validate_constexpr_redeclaration): Allow an explicit
specialization to be different wrt the constexpr specifier.
/testsuite
2013-04-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/56871
* g++.dg/cpp0x/constexpr-specialization.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197597 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r-- | gcc/cp/decl.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 70137f4a7fc..01804d2cf68 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1196,12 +1196,21 @@ validate_constexpr_redeclaration (tree old_decl, tree new_decl) if (DECL_DECLARED_CONSTEXPR_P (old_decl) == DECL_DECLARED_CONSTEXPR_P (new_decl)) return true; - if (TREE_CODE (old_decl) == FUNCTION_DECL && DECL_BUILT_IN (old_decl)) + if (TREE_CODE (old_decl) == FUNCTION_DECL) { - /* Hide a built-in declaration. */ - DECL_DECLARED_CONSTEXPR_P (old_decl) - = DECL_DECLARED_CONSTEXPR_P (new_decl); - return true; + if (DECL_BUILT_IN (old_decl)) + { + /* Hide a built-in declaration. */ + DECL_DECLARED_CONSTEXPR_P (old_decl) + = DECL_DECLARED_CONSTEXPR_P (new_decl); + return true; + } + /* 7.1.5 [dcl.constexpr] + Note: An explicit specialization can differ from the template + declaration with respect to the constexpr specifier. */ + if (! DECL_TEMPLATE_SPECIALIZATION (old_decl) + && DECL_TEMPLATE_SPECIALIZATION (new_decl)) + return true; } error ("redeclaration %qD differs in %<constexpr%>", new_decl); error ("from previous declaration %q+D", old_decl); |