Commit 71506d41 by Paolo Carlini Committed by Paolo Carlini

re PR c++/65977 (Constexpr should be allowed in declaration of friend template specialization)

/cp
2015-06-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/65977
	* decl.c (grokfndecl): Allow constexpr declarations of friend
	template specializations.

/testsuite
2015-06-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/65977
	* g++.dg/cpp0x/constexpr-friend-3.C: New.
	* g++.dg/cpp0x/constexpr-friend-2.C: Adjust.

From-SVN: r225148
parent 9b552079
2015-06-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65977
* decl.c (grokfndecl): Allow constexpr declarations of friend
template specializations.
2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org> 2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/66605 PR fortran/66605
......
...@@ -7738,15 +7738,12 @@ grokfndecl (tree ctype, ...@@ -7738,15 +7738,12 @@ grokfndecl (tree ctype,
} }
if (inlinep & 1) if (inlinep & 1)
error ("%<inline%> is not allowed in declaration of friend " {
"template specialization %qD", error ("%<inline%> is not allowed in declaration of friend "
decl); "template specialization %qD",
if (inlinep & 2) decl);
error ("%<constexpr%> is not allowed in declaration of friend " return NULL_TREE;
"template specialization %qD", }
decl);
if (inlinep)
return NULL_TREE;
} }
} }
......
2015-06-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65977
* g++.dg/cpp0x/constexpr-friend-3.C: New.
* g++.dg/cpp0x/constexpr-friend-2.C: Adjust.
2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org> 2015-06-29 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR fortran/66605 PR fortran/66605
......
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
template<typename T> void f(T); template<typename T> void f(T);
template <class T> class A { template <class T> class A {
friend constexpr void f<>(int); // { dg-error "'constexpr' is not allowed" } friend constexpr void f<>(int);
}; };
// PR c++/65977
// { dg-do compile { target c++11 } }
template<__SIZE_TYPE__>
class bitset;
template<__SIZE_TYPE__ N>
constexpr bool operator==(const bitset<N>&, const bitset<N>&) noexcept;
template<__SIZE_TYPE__ N>
class bitset
{
friend constexpr bool operator== <>(const bitset<N>&,
const bitset<N>&) noexcept;
};
template<__SIZE_TYPE__ N>
constexpr bool operator==(const bitset<N>&, const bitset<N>&) noexcept
{
return true;
}
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