https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114548

--- Comment #3 from Gaius Mulley <gaius at gcc dot gnu.org> ---
Created attachment 57840
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57840&action=edit
Proposed fix

Here is a proposed patch (which fixes all the standard procedure function
const/var parameter checking):

$ gm2 -fiso testcmplx.mod 
testcmplx.mod:4:17: error: In program module ‘testcmplx’: the procedure
function ‘CMPLX’ is being called from within a constant expression and
therefore the parameter ‘r’ must be a constant, seen a variable
    4 |    foo = CMPLX (r, i) ;
      |                 ^
testcmplx.mod:4:20: error: the procedure function ‘CMPLX’ is being called from
within a constant expression and therefore the parameter ‘i’ must be a
constant, seen a variable
    4 |    foo = CMPLX (r, i) ;
      |                    ^
testcmplx.mod:4:8: error: in assignment, cannot assign a variable to a constant
‘foo’
    4 |    foo = CMPLX (r, i) ;
      |    ~~~~^~~~~~~~~~~~~
testcmplx.mod:4:4: error: designator ‘foo’ is declared as a CONST
    4 |    foo = CMPLX (r, i) ;
      |    ^~~

Reply via email to