Jump to content
Sign in to follow this  
Lars Fosdal

RSP-23024: Record helper class constructor gives senseless compiler warning

Recommended Posts



If a record helper has a class constructor, the compiler will output the following error

[dcc32 Warning] W1035 Return value of function 'THelperType.ClassConstructorName' might be undefined

This doesn't make sense, since a class constructor doesn't have an assignable result value.

Note that the class constructor actually works as expected - it is only the bogus warning that is a problem.

Our build server is configured to not accept warning W1035, to ensure that we actually never release code which may have undefined return values, so this false warning is a problem.

MCVE attatched to report.

Share this post

Link to post
8 minutes ago, Stefan Glienke said:

Not really as you can turn off this warning with {$WARN NO_RETVAL OFF}

That is a good point.

I ended up calling a class method that do the init code in the unit init section.


It still is a strange warning, though.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this