https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106154
Bug ID: 106154 Summary: Error when missing a : inside an inline-asm could be improved Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: diagnostic, inline-asm Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: pinskia at gcc dot gnu.org Target Milestone: --- Take: ``` void f(void) { __asm__(""::"memory"); } ``` I forgot there should be 3 : and the error message for this should be improved. Currently it is: ``` <source>: In function 'f': <source>:3:25: error: expected '(' before ')' token 3 | __asm__(""::"memory"); | ^ | ( ``` I was like what does that even mean and then I remembered there is output, input and clobber for the asm statement. Note both the C and C++ front-ends have the same issue and produce the same error message. Well C++ produces some extra ones error messages: ``` <source>:3:25: error: expected primary-expression before ')' token <source>:3:26: error: expected ')' before ';' token 3 | __asm__(""::"memory"); | ^ | ) ``` clang is not only slightly better: ``` <source>:3:25: error: expected '(' after 'asm operand' __asm__(""::"memory"); ^ ```