[llvm] r337588 - Fix linker failure with Any.

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 23 16:06:54 PDT 2018


On Fri, Jul 20, 2018 at 10:55 AM Zachary Turner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: zturner
> Date: Fri Jul 20 10:50:53 2018
> New Revision: 337588
>
> URL: http://llvm.org/viewvc/llvm-project?rev=337588&view=rev
> Log:
> Fix linker failure with Any.
>
> This is due to a difference in MS ABI which is why I didn't see
> it locally.  The included fix should work on all compilers.
>
> Modified:
>     llvm/trunk/include/llvm/ADT/Any.h
>
> Modified: llvm/trunk/include/llvm/ADT/Any.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Any.h?rev=337588&r1=337587&r2=337588&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/Any.h (original)
> +++ llvm/trunk/include/llvm/ADT/Any.h Fri Jul 20 10:50:53 2018
> @@ -25,7 +25,7 @@
>  namespace llvm {
>
>  class Any {
> -  template <typename T> struct TypeId { static const char Id = 0; };
> +  template <typename T> struct TypeId { static const char Id; };
>

FWIW - you can leave the initializer here ^ even though there's an out of
line definition, if you like.


>
>    struct StorageBase {
>      virtual ~StorageBase() = default;
> @@ -99,6 +99,9 @@ private:
>    std::unique_ptr<StorageBase> Storage;
>  };
>
> +template <typename T> const char Any::TypeId<T>::Id = 0;
> +
> +
>  template <typename T> bool any_isa(const Any &Value) {
>    if (!Value.Storage)
>      return false;
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180723/78894e2c/attachment.html>


More information about the llvm-commits mailing list