Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp] "no matching overloaded function" with nested Vectors #5957

Closed
Gama11 opened this issue Jan 24, 2017 · 5 comments
Closed

[cpp] "no matching overloaded function" with nested Vectors #5957

Gama11 opened this issue Jan 24, 2017 · 5 comments
Assignees
Labels
platform-cpp Everything related to CPP / C++ regression
Milestone

Comments

@Gama11
Copy link
Member

Gama11 commented Jan 24, 2017

This compiles in Haxe 3.2.1, making it another regression.

import haxe.ds.Vector;

class Main {
	static var foo:Vector<Vector<Int>> = new Vector<Vector<Int>>(10);

	public static function main() {
		foo[0][0] += 1;
	}
}
./src/Main.cpp(34): error C2374: 'this11': redefinition; multiple initialization
./src/Main.cpp(32): note: see declaration of 'this11'
./src/Main.cpp(35): error C2672: '_hx_array_unsafe_get': no matching overloaded function found
Error: Build failed

Interestingly, the error goes away when turning foo into a local var.
Tested with Haxe 3.4.0-rc.2 + latest hxcpp dev.

@Gama11 Gama11 changed the title [cpp] "no matching overloaded" with nested Vectors [cpp] "no matching overloaded function" with nested Vectors Jan 24, 2017
@Simn Simn added platform-cpp Everything related to CPP / C++ regression labels Jan 24, 2017
@Simn Simn added this to the 3.4 milestone Jan 24, 2017
@Simn
Copy link
Member

Simn commented Jan 24, 2017

Goddammit gama...

@Simn
Copy link
Member

Simn commented Jan 30, 2017

@hughsando: This is the last open 3.4 issue labeled as a regression. Anything to be done here?

@hughsando
Copy link
Member

Looks like a problem with the inline-er, since the '-D dump' declares the this11 variable twice.
Python has a similar construct, but I assume no such error.

I think it comes from "+=" where this11 is used in both the left and right hand sides.
The difference between c++ and python might be that cpp used "this.get" member notation, while python uses "get(this,..)" static notation.

@Simn Simn self-assigned this Jan 30, 2017
@Simn
Copy link
Member

Simn commented Jan 30, 2017

Ah, I kind of ignored the duplicate var because the issue title talks about the other error. I suppose that makes this my problem...

@Simn
Copy link
Member

Simn commented Jan 30, 2017

Inline get:
	Args: 
		index<512> = 0
		this<511> = Main.foo
		_this<510> = haxe.ds._Vector.Vector_Impl_
	Expr: {
		return cpp.NativeArray.unsafeGet(this<423>, index<424>);
	}
	Result: {
		var this<511> = Main.foo;
		cpp.NativeArray.unsafeGet(cast this<511>, 0);
	}
Inline get:
	Args: 
		index<516> = 0
		this<515> = {
			var this<511> = Main.foo;
			cpp.NativeArray.unsafeGet(cast this<511>, 0);
		}
		_this<514> = haxe.ds._Vector.Vector_Impl_
	Expr: {
		return cpp.NativeArray.unsafeGet(this<423>, index<424>);
	}
	Result: {
		var this<515> = {
			var this<511> = Main.foo;
			cpp.NativeArray.unsafeGet(cast this<511>, 0);
		};
		cpp.NativeArray.unsafeGet(cast this<515>, 0);
	}
Inline set:
	Args: 
		val<521> = {
			var this<515> = {
				var this<511> = Main.foo;
				cpp.NativeArray.unsafeGet(cast this<511>, 0);
			};
			cpp.NativeArray.unsafeGet(cast this<515>, 0);
		} + 1
		index<520> = 0
		this<519> = {
			var this<511> = Main.foo;
			cpp.NativeArray.unsafeGet(cast this<511>, 0);
		}
		_this<518> = haxe.ds._Vector.Vector_Impl_
	Expr: {
		return cast this<425>.__unsafe_set(index<426>, val<427>);
	}
	Result: {
		var this<519> = {
			var this<511> = Main.foo;
			cpp.NativeArray.unsafeGet(cast this<511>, 0);
		};
		var val<521> = {
			var this<515> = {
				var this<511> = Main.foo;
				cpp.NativeArray.unsafeGet(cast this<511>, 0);
			};
			cpp.NativeArray.unsafeGet(cast this<515>, 0);
		} + 1;
		cast cast this<519>.__unsafe_set(0, val<521>);
	}

So the problem seems to be that two different calls pull the same abstract this variable (511) into the scope.

@Simn Simn closed this as completed in 70d6095 Jan 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform-cpp Everything related to CPP / C++ regression
Projects
None yet
Development

No branches or pull requests

3 participants