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

Erroneous visibility error, or a problem in libc++ #14034

Closed
DimitryAndric opened this issue Aug 22, 2012 · 3 comments
Closed

Erroneous visibility error, or a problem in libc++ #14034

DimitryAndric opened this issue Aug 22, 2012 · 3 comments
Labels
bugzilla c++

Comments

@DimitryAndric
Copy link
Collaborator

DimitryAndric commented Aug 22, 2012

Bugzilla Link 13662
Resolution FIXED
Resolved on Aug 22, 2012 09:53
Version trunk
OS All
CC @d0k,@DougGregor

Extended Description

For the following:

#pragma GCC visibility push(hidden)
template class attribute((visibility("default"))) foo;
class bar { template friend class foo; };

clang emits the following error:

t.cpp:1:13: error: visibility does not match previous declaration
#pragma GCC visibility push(hidden)
^
t.cpp:2:40: note: previous attribute is here
template class attribute((visibility("default"))) foo;
^
1 error generated.

Not only does the error point to the incorrect location (see bug 13658),
but it also seems to be wrong. At least, r160105 doesn't complain about
it, while r160495 does (I'm still bisecting).

The sample has been reduced from the following, something which Firefox
apparently does, and which now doesn't work with libc++:

#pragma GCC visibility push(hidden)
#include

In libc++ , it first includes at least one forward declaration
of basic_string with a default visibility attribute, and then follows:

template
class __wrap_iter
{
...
template <class _CharT, class _Traits, class _Alloc> friend class basic_string;

And this now causes an error with clang trunk.

@DimitryAndric
Copy link
Collaborator Author

DimitryAndric commented Aug 22, 2012

Note also that the testcase with the templates removed, e.g.:

#pragma GCC visibility push(hidden)
class attribute((visibility("default"))) foo;
class bar { friend class foo; };

compiles without error. Apparently the visibility isn't a problem
then...

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 22, 2012

I will take a look.

@llvmbot
Copy link
Collaborator

llvmbot commented Aug 22, 2012

Fixed in r162360.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla c++
Projects
None yet
Development

No branches or pull requests

2 participants