Skip to content

if (c) ++x; doesn't compile: "malformed if statement" #16303

Closed as not planned
Closed as not planned

Description

@DiasFranciscoA

if (c) ++x; doesn't compile: "Assignment operator expected" and "malformed if statement". With braces, if (c) { ++x; }, or with x++ it builds.

var _n = 0;
if (_n == 0) ++_n;
  1. Open the attached project
  2. Build it for Windows, VM or YYC: the compile fails on the if line in obj_main's Create

Always, 2026.100 Beta (runtime-2026.100.0.1128), Windows.

Activity

  1. DiasFranciscoA commented on Oct 25, 2026

    @DiasFranciscoA
    Author

    This might be just a quirk of how GML works, since (_n == 0)++ is actually the considered expression.

  2. moved this from Triage to Backlog in Team Workloadon Oct 26, 2026
  3. added this to the 2026.1.0 milestone on Oct 26, 2026
  4. moved this from Backlog to Todo in Team Workloadon Oct 26, 2026
  5. rwkay commented on Oct 26, 2026

    @rwkay

    Wont Fix: This is an issue with the GML parser and is not something we are planning on fixing for the current runtime (it may be fixed in GMRT going forward) the expression is ambiguous, add in curly braces to the body of the if to show exactly what you are intending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions