[llvm-bugs] [Bug 33871] New: "visibility does not match previous declaration" error could be more useful

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 20 21:35:42 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33871

            Bug ID: 33871
           Summary: "visibility does not match previous declaration" error
                    could be more useful
           Product: clang
           Version: 5.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mh+llvm at glandium.org
                CC: llvm-bugs at lists.llvm.org

Reduced testcase:

  #pragma GCC visibility push(hidden)

  class Foo;

  class __attribute__((visibility("default"))) Foo {
  };


Compiling the above fails with:

  test.cc:5:22: error: visibility does not match previous declaration
  class __attribute__((visibility("default"))) Foo {
                     ^
  test.cc:1:13: note: previous attribute is here
  #pragma GCC visibility push(hidden)

While technically entirely accurate, in real cases, the #pragma is not
necessarily close to the forward declaration, and it's really not obvious
what's wrong, and can lead to some unnecessary hair pulling.

The error message should mention the forward declaration somehow.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170721/9742c3b1/attachment.html>


More information about the llvm-bugs mailing list