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

Can't have multiple anonymous unions which redeclare members #7113

Closed
llvmbot opened this issue Mar 30, 2010 · 2 comments
Closed

Can't have multiple anonymous unions which redeclare members #7113

llvmbot opened this issue Mar 30, 2010 · 2 comments
Labels
bugzilla Issues migrated from bugzilla c++

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 30, 2010

Bugzilla Link 6741
Resolution FIXED
Resolved on Sep 23, 2010 09:26
Version trunk
OS MacOS X
Attachments testcase
Reporter LLVM Bugzilla Contributor
CC @akyrtzi,@DougGregor

Extended Description

Perhaps this is a violation of the spec and clang is right to disallow it, however it does crop up in "real world" code so it might be better for this to be a warning rather than an error. Here is a small example of what I'm talking about

p.s. As it happens the one use of this in the AVM code base is entirely frivolous and can easily be removed, but perhaps it affects other codebases...

void foo() {
union {
char *m_a;
int *m_b;
};
// some code

if(somecondition) {
	union {
		char *m_a;
		int *m_b;
	};
	// some code
}

}

Currently clang gives you the following error:

union-bug.cpp:11:10: error: member of anonymous union redeclares 'm_a'
char *m_a;
^
union-bug.cpp:5:9: note: previous declaration is here
char *m_a;

@akyrtzi
Copy link
Contributor

akyrtzi commented Jul 30, 2010

This seems like a bogus error. Consider this case:

typedef void *voidPtr;

void f() {
union { int **ctxPtr; void **voidPtr; };
}

t.cpp:4:31: error: member of anonymous union redeclares 'voidPtr'
union { int **ctxPtr; void **voidPtr; };
^
t.cpp:1:15: note: previous declaration is here
typedef void *voidPtr;
^

@akyrtzi
Copy link
Contributor

akyrtzi commented Sep 23, 2010

Fixed at r114641.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this issue Aug 3, 2023
[lldb] Make access to ReflectionContext thread safe
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla c++
Projects
None yet
Development

No branches or pull requests

2 participants