-
-
Notifications
You must be signed in to change notification settings - Fork 694
Open
Description
function main() {
final a:Int = 10;
final b:cpp.Star<Int> = a;
}Error: ./src/_Main/Main_Fields_.cpp: In static member function ‘static void _Main::Main_Fields__obj::main()’:
./src/_Main/Main_Fields_.cpp:29:19: error: invalid conversion from ‘int’ to ‘int*’ [-fpermissive]
29 | int * b = a;
| ^
| |
| int
./src/_Main/Main_Fields_.cpp:29:19: note: possible fix: take the address with ‘&’
29 | int * b = a;
| ^
| &
Also, code like this should not be permitted as you cannot get a pointer to temporary rvalue:
function main() {
final a:cpp.Star<Int> = 10;
}This should be handled similarly to #12457.
Also compare with a similar error on the hashlink target:
[ERROR] Test.hx:3: characters 41-43
3 | final ref:hl.Ref<Int> = hl.Ref.make(10);
| ^^
| Ref should be a local variable
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels