[LLVMbugs] [Bug 13662] New: Erroneous visibility error, or a problem in libc++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 22 05:28:38 PDT 2012


             Bug #: 13662
           Summary: Erroneous visibility error, or a problem in libc++
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dimitry at andric.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

For the following:

  #pragma GCC visibility push(hidden)
  template<class T> class __attribute__((__visibility__("default"))) foo;
  class bar { template<class T> 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 T> 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 <iterator>

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

  template <class _Iter>
  class __wrap_iter
      template <class _CharT, class _Traits, class _Alloc> friend class

And this now causes an error with clang trunk.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list