HaxeFoundation / HaxeFoundation/haxe

[cpp] type 'null' does not have an overloaded member 'operator ->'

Open
#5,074 41 comments 0 reactions 1 assignee Claimed by @waneck View on GitHub
bug feature-analyzer
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

``` haxe
class Main {
public static function main() {}

var def(default, set):Def;

function destroy() {
def = null;
}

inline function set_def(newDef:Def):Def {
newDef.apply();
return newDef;
}
}

class Def {
public function apply() null;
}
```

```
./src/Main.cpp(32): error C2819: type 'null' does not have an overloaded member 'operator ->'
c:\haxetoolkit\haxe\lib\hxcpp\git\include\null.h(66): note: see declaration of 'null'
./src/Main.cpp(32): note: did you intend to use '.' instead?
./src/Main.cpp(32): error C2039: 'apply': is not a member of 'null'
c:\haxetoolkit\haxe\lib\hxcpp\git\include\null.h(66): note: see declaration of 'null'
```

Interesting dump:

``` haxe
destroy(method) : Void -> Void

= function() = {
null.apply();
}
```

Regression.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.