diff --git a/compiler/symtable.pas b/compiler/symtable.pas index c3f674b7ee..68ae011b07 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -560,8 +560,9 @@ implementation if (vo_is_funcret in tabstractvarsym(sym).varoptions) then begin { don't warn about the result of constructors } - if (tsym(sym).owner.symtabletype<>localsymtable) or - (tprocdef(tsym(sym).owner.defowner).proctypeoption<>potype_constructor) then + if ((tsym(sym).owner.symtabletype<>localsymtable) or + (tprocdef(tsym(sym).owner.defowner).proctypeoption<>potype_constructor)) and + not(cs_opt_nodedfa in current_settings.optimizerswitches) then MessagePos(tsym(sym).fileinfo,sym_w_function_result_not_set) end else if (tsym(sym).owner.symtabletype=parasymtable) then