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

Expanding an empty tuple erases side effects #20842

Open
tgehr opened this issue Feb 10, 2025 · 0 comments
Open

Expanding an empty tuple erases side effects #20842

tgehr opened this issue Feb 10, 2025 · 0 comments
Assignees
Labels

Comments

@tgehr
Copy link
Contributor

tgehr commented Feb 10, 2025

DMD v2.109.1:

struct Tuple(T...){
	T expand;
}
int x = 0;
Tuple!() foo(){
	x = 2;
	return Tuple!()();
}
void main(){
	auto empty = foo().expand;
	assert(x == 2); // fail
}

The expected behavior is that the assertion passes.

@tgehr tgehr self-assigned this Feb 10, 2025
@thewilsonator thewilsonator added the Feature:tuple AliasSeq label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants