+2015-12-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/67592
+ * decl.c (grokdeclarator): Reject constexpr virtual member functions;
+ in error messages, prefer %<virtual%> and %<constexpr%> to virtual
+ and constexpr, respectively.
+
2015-12-18 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/68831
if (storage_class == sc_static)
staticp = 1 + (decl_context == FIELD);
- if (virtualp && staticp == 2)
+ if (virtualp)
{
- error ("member %qD cannot be declared both virtual and static", dname);
- storage_class = sc_none;
- staticp = 0;
+ if (staticp == 2)
+ {
+ error ("member %qD cannot be declared both %<virtual%> "
+ "and %<static%>", dname);
+ storage_class = sc_none;
+ staticp = 0;
+ }
+ if (constexpr_p)
+ error ("member %qD cannot be declared both %<virtual%> "
+ "and %<constexpr%>", dname);
}
friendp = decl_spec_seq_has_spec_p (declspecs, ds_friend);
explicitp = 2;
if (virtualp)
{
- permerror (input_location, "constructors cannot be declared virtual");
+ permerror (input_location,
+ "constructors cannot be declared %<virtual%>");
virtualp = 0;
}
if (decl_context == FIELD
ARM 9.5 */
if (virtualp && TREE_CODE (ctype) == UNION_TYPE)
{
- error ("function %qD declared virtual inside a union",
+ error ("function %qD declared %<virtual%> inside a union",
unqualified_id);
return error_mark_node;
}
{
if (virtualp)
{
- error ("%qD cannot be declared virtual, since it "
+ error ("%qD cannot be declared %<virtual%>, since it "
"is always static",
unqualified_id);
virtualp = 0;
+2015-12-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/67592
+ * g++.dg/cpp0x/constexpr-virtual5.C: New.
+ * g++.dg/cpp0x/pr51463.C: Adjust dg-error string.
+ * g++.dg/inherit/pure1.C: Likewise.
+
2015-12-18 Jeff Law <law@redhat.com>
PR rtl-optimization/49847
{
void foo2() = 0; // { dg-error "non-virtual" }
static void foo3() = 0; // { dg-error "static member" }
- virtual static void foo4() = 0; // { dg-error "both virtual and static" }
+ virtual static void foo4() = 0; // { dg-error "both 'virtual' and 'static'" }
virtual void foo5() = 0; // { dg-error "base class" }
};