Opened 17 years ago
Closed 14 years ago
#65 closed Bug (Wont Fix)
Au3Check gives wrong error with Const ByRef params
Reported by: | Valik | Owned by: | Valik |
---|---|---|---|
Milestone: | Component: | Other | |
Version: | 3.2.10.0 | Severity: | None |
Keywords: | Au3Check | Cc: |
Description (last modified by Valik)
The following code:
CallNonConst() CallConst() Func CallNonConst() Local $a = 32 TakesConstByRef($a) EndFunc Func CallConst() Local Const $a = 32 TakesConstByRef($a) EndFunc Func TakesConstByRef(Const ByRef $c) ConsoleWrite($c & @CRLF) EndFunc
produces this error:
New AutoIt v3 Script.au3(15,37) : ERROR: TakesConstByRef() previously called with expression on Const ByRef param(s). Func TakesConstByRef(Const ByRef $c) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ New AutoIt v3 Script.au3(6,20) : REF: first call to TakesConstByRef(). TakesConstByRef($a) ~~~~~~~~~~~~~~~~~~^ New AutoIt v3 Script.au3 - 1 error(s), 0 warning(s)
The error is wrong. The code is perfectly valid. The problem is using a non-const and a const in the same script with the same function. It seems Au3Check is trying to infer something incorrectly. If you modify both examples to be identical (Either add Const to the Local it's missing from or remove it from the one where it's present) then there is no error. All Au3Check needs to worry about is making sure a variable is being passed to the ByRef statement, it doesn't need to concern itself if the variable is Const or not.
Attachments (0)
Change History (4)
comment:1 Changed 17 years ago by Valik
- Description modified (diff)
- Summary changed from Au3Check gives wrong warning with Const ByRef params to Au3Check gives wrong error with Const ByRef params
comment:2 Changed 17 years ago by Valik
- Owner set to Jos
- Status changed from new to assigned
comment:3 Changed 16 years ago by Valik
- Owner changed from Jos to Valik
- Severity set to None
comment:4 Changed 14 years ago by Jon
- Resolution set to Wont Fix
- Status changed from assigned to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.