mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-21 23:00:52 +08:00
re PR c++/48945 ([C++0x] static constexpr member function cannot be defined out-of class)
PR c++/48945 * decl.c (revert_static_member_fn): Ignore const on constexpr fn. From-SVN: r174006
This commit is contained in:
parent
967444bbf8
commit
b6413764c0
@ -1,5 +1,8 @@
|
||||
2011-05-20 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/48945
|
||||
* decl.c (revert_static_member_fn): Ignore const on constexpr fn.
|
||||
|
||||
PR c++/48780
|
||||
* cvt.c (type_promotes_to): Don't promote scoped enums.
|
||||
|
||||
|
@ -13575,10 +13575,15 @@ void
|
||||
revert_static_member_fn (tree decl)
|
||||
{
|
||||
tree stype = static_fn_type (decl);
|
||||
cp_cv_quals quals = type_memfn_quals (stype);
|
||||
|
||||
if (type_memfn_quals (stype) != TYPE_UNQUALIFIED)
|
||||
if (quals != TYPE_UNQUALIFIED)
|
||||
{
|
||||
error ("static member function %q#D declared with type qualifiers", decl);
|
||||
if (quals == TYPE_QUAL_CONST && DECL_DECLARED_CONSTEXPR_P (decl))
|
||||
/* The const was implicit, don't complain. */;
|
||||
else
|
||||
error ("static member function %q#D declared with type qualifiers",
|
||||
decl);
|
||||
stype = apply_memfn_quals (stype, TYPE_UNQUALIFIED);
|
||||
}
|
||||
TREE_TYPE (decl) = stype;
|
||||
|
@ -1,5 +1,7 @@
|
||||
2011-05-20 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* g++.dg/cpp0x/constexpr-static7.C: New.
|
||||
|
||||
* g++.dg/cpp0x/enum12.C: New.
|
||||
* g++.dg/cpp0x/enum13.C: New.
|
||||
|
||||
|
8
gcc/testsuite/g++.dg/cpp0x/constexpr-static7.C
Normal file
8
gcc/testsuite/g++.dg/cpp0x/constexpr-static7.C
Normal file
@ -0,0 +1,8 @@
|
||||
// PR c++/48945
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
struct A {
|
||||
static constexpr bool is();
|
||||
};
|
||||
|
||||
constexpr bool A::is() { return true; }
|
Loading…
x
Reference in New Issue
Block a user