"previous declaration of %qD", olddecl);
}
+ /* [dcl.fct.def.delete] A deleted definition of a function shall be the
+ first declaration of the function or, for an explicit specialization
+ of a function template, the first declaration of that
+ specialization. */
if (!(DECL_TEMPLATE_INSTANTIATION (olddecl)
&& DECL_TEMPLATE_SPECIALIZATION (newdecl)))
{
if (DECL_DELETED_FN (newdecl))
{
auto_diagnostic_group d;
- error_at (newdecl_loc, "deleted definition of %qD", newdecl);
+ pedwarn (newdecl_loc, OPT_Wpedantic,
+ "deleted definition of %qD is not first declaration",
+ newdecl);
inform (olddecl_loc,
"previous declaration of %qD", olddecl);
}
&& TREE_CHAIN (init) == NULL_TREE)
init = NULL_TREE;
- value = grokdeclarator (declarator, declspecs, FIELD, init != 0, &attrlist);
+ int initialized;
+ if (init == ridpointers[(int)RID_DELETE])
+ initialized = SD_DELETED;
+ else if (init == ridpointers[(int)RID_DEFAULT])
+ initialized = SD_DEFAULTED;
+ else if (init)
+ initialized = SD_INITIALIZED;
+ else
+ initialized = SD_UNINITIALIZED;
+
+ value = grokdeclarator (declarator, declspecs, FIELD, initialized, &attrlist);
if (! value || value == error_mark_node)
/* friend or constructor went bad. */
return error_mark_node;
{
if (init == ridpointers[(int)RID_DELETE])
{
- if (friendp && decl_defined_p (value))
- {
- error ("redefinition of %q#D", value);
- inform (DECL_SOURCE_LOCATION (value),
- "%q#D previously defined here", value);
- }
- else
- {
- DECL_DELETED_FN (value) = 1;
- DECL_DECLARED_INLINE_P (value) = 1;
- DECL_INITIAL (value) = error_mark_node;
- }
+ DECL_DELETED_FN (value) = 1;
+ DECL_DECLARED_INLINE_P (value) = 1;
}
else if (init == ridpointers[(int)RID_DEFAULT])
{
DECL_DEFAULTED_FN (value) = 1;
DECL_INITIALIZED_IN_CLASS_P (value) = 1;
DECL_DECLARED_INLINE_P (value) = 1;
+ /* grokfndecl set this to error_mark_node, but we want to
+ leave it unset until synthesize_method. */
+ DECL_INITIAL (value) = NULL_TREE;
}
}
else if (TREE_CODE (init) == DEFERRED_PARSE)