Skip to content

Commit ccd2ae7

Browse files
committed
c++, contracts: Make sure we treat void fns as such - not variadic.
1 parent 34c8ea1 commit ccd2ae7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

gcc/cp/contracts.cc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,6 +1459,8 @@ set_contract_functions (tree fndecl, tree pre, tree post)
14591459
static tree
14601460
copy_fn_decl (tree fndecl)
14611461
{
1462+
gcc_checking_assert (!error_operand_p (fndecl));
1463+
14621464
tree decl = copy_decl (fndecl);
14631465
DECL_ATTRIBUTES (decl) = copy_list (DECL_ATTRIBUTES (fndecl));
14641466

@@ -1467,9 +1469,16 @@ copy_fn_decl (tree fndecl)
14671469
DECL_RESULT (decl) = copy_decl (DECL_RESULT (fndecl));
14681470
DECL_CONTEXT (DECL_RESULT (decl)) = decl;
14691471
}
1470-
if (!DECL_ARGUMENTS (fndecl) || VOID_TYPE_P (DECL_ARGUMENTS (fndecl)))
1472+
1473+
if (!DECL_ARGUMENTS (fndecl))
14711474
return decl;
14721475

1476+
if (VOID_TYPE_P (DECL_ARGUMENTS (fndecl)))
1477+
{
1478+
DECL_ARGUMENTS (decl) = void_list_node;
1479+
return decl;
1480+
}
1481+
14731482
tree last = DECL_ARGUMENTS (decl) = copy_decl (DECL_ARGUMENTS (decl));
14741483
DECL_CONTEXT (last) = decl;
14751484
for (tree p = TREE_CHAIN (DECL_ARGUMENTS (fndecl)); p; p = TREE_CHAIN (p))

0 commit comments

Comments
 (0)