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

[clang] Designated Initializer + Anonymous Union + Generic Lambda false positive assignment bug #62023

Closed
rfenelus opened this issue Apr 8, 2023 · 3 comments
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party rejects-valid

Comments

@rfenelus
Copy link

rfenelus commented Apr 8, 2023

This combination of a designated initializers, an anonymous union, and a generic lambda does not compile in Clang but does compile in GCC and MSVC. Replacing the assignment value with an expression that doesn't include a variable seems to work but breaks with variables.

int main(){
	struct Value{
		union{
			double value;
		};
	};

	auto Lambda = [](auto self) -> Value{
		double v  = 0;
		return Value{.value = v};
	};

	Lambda (Lambda);
}

Godbolt

@shafik
Copy link
Collaborator

shafik commented Apr 9, 2023

Confirmed, this looks like: #57436

@shafik shafik added confirmed Verified by a second party rejects-valid labels Apr 9, 2023
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Apr 9, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 9, 2023

@llvm/issue-subscribers-clang-frontend

@Fznamznon
Copy link
Contributor

I think this is fixed by #69712 , online demo - https://godbolt.org/z/bT1s85dfe .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" confirmed Verified by a second party rejects-valid
Projects
None yet
Development

No branches or pull requests

5 participants