Diagnostic and cause
링크Invalid defer body
- 계열
- topaz
- 단계
- parse
- 코드
TPZ2004
원인과 조건
The body of a defer statement must be a block (topaz.decision.defer-block-only.1).
관련 규칙 · Trigger and repair →대응
Place the deferred work in a block.
Compiler phase: parse.
Compiler explanation: A defer statement body is neither a block nor a call expression.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
defertakes a block or a call Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ2004]:
defertakes a block or a call
A defer statement has a body that is not a block.
Trigger and repair
The body of a defer statement must be a block (topaz.decision.defer-block-only.1).
Response
링크Place the deferred work in a block.
Reproduction and verification
링크Rejected program
링크defer 1
표준 출력 없음.기대 결과
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
링크defer {}
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
This program applies the repair described above. The verification status records whether it has been run.