File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -5982,6 +5982,21 @@ start_decl (const cp_declarator *declarator,
5982
5982
return error_mark_node;
5983
5983
}
5984
5984
5985
+ if (flag_contracts_nonattr
5986
+ && TREE_CODE (decl) == FUNCTION_DECL
5987
+ && !processing_template_decl
5988
+ && DECL_RESULT (decl)
5989
+ && is_auto (TREE_TYPE (DECL_RESULT (decl))))
5990
+ for (tree contract = DECL_CONTRACTS (decl); contract;
5991
+ contract = CONTRACT_CHAIN (contract))
5992
+ if (POSTCONDITION_P (CONTRACT_STATEMENT (contract))
5993
+ && POSTCONDITION_IDENTIFIER (CONTRACT_STATEMENT (contract)))
5994
+ {
5995
+ error_at (DECL_SOURCE_LOCATION (decl),
5996
+ "postconditions with deduced result name types must only"
5997
+ " appear on function definitions");
5998
+ return error_mark_node;
5999
+ }
5985
6000
/* Save the DECL_INITIAL value in case it gets clobbered to assist
5986
6001
with attribute validation. */
5987
6002
initial = DECL_INITIAL (decl);
You can’t perform that action at this time.
0 commit comments