[llvm-bugs] [Bug 42027] [Win] LNK2005: bool const std::_Is_integral<bool> already defined

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 12 14:08:58 PDT 2019


Reid Kleckner <rnk at google.com> changed:

           What    |Removed                     |Added
             Status|CONFIRMED                   |RESOLVED
         Resolution|---                         |FIXED

--- Comment #12 from Reid Kleckner <rnk at google.com> ---
I made clang give constexpr explicit specializations of variable templates
linkonce_odr linkage in r363191. This makes it so clang doesn't emit these
_Is_integral symbols in every object file that transitively includes
xtr1common, and if they are needed, they won't cause duplicate symbol errors.

This has essentially the same effect as implicitly considering all constexpr
variable templates as being marked 'inline'. It isn't strictly conforming,
because you could do this:

// tu1.cpp
template <class> const int foo;
extern template <> const int foo<int>;
const int *useit() { return &foo<int>; }
// tu2.cpp
template <class> const int foo;
template <> constexpr int foo<int> = 42;

With my change, clang will not emit foo<int> in tu2.cpp as written. But, for
constexpr variable templates, I think this will be very uncommon. The point of
constexpr is to be able to write constants and put them in headers to enable
further optimization.

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/20190612/a5716ae2/attachment.html>

More information about the llvm-bugs mailing list