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: unassignedclangb...@nondot.org
          Reporter: mh+l...@glandium.org
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to