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

            Bug ID: 34614
           Summary: clang silently ignores visibility attributes after
                    implicit instantiation
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: smee...@fb.com
                CC: compn...@compnerd.org, dgre...@apple.com,
                    e...@efcs.ca, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

% cat repro.cc
template <class> class c { void f() {} };
template <> void c<int>::f() {}
template class __attribute__((__visibility__("default"))) c<int>;

% clang++ -std=c++11 -fvisibility=hidden -fvisibility-inlines-hidden \
    -Wall -S -emit-llvm -o - | grep _ZN1cIiE1fEv
define hidden void @_ZN1cIiE1fEv(%class.c* %this) #0 align 2 {

The specialization on line 2 causes an implicit instantiation, which causes the
attributes on the explicit instantiation to be ignored. Ignoring the attributes
is a perfectly sane thing to do, but we should at least warn when we're doing
this, similar to gcc:

% g++ -std=c++11 -fsyntax-only repro.cc
repro.cc:3:59: warning: type attributes ignored after type is already defined
[-Wattributes]
 template class __attribute__((__visibility__("default"))) c<int>;

-- 
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