[Openmp-commits] [PATCH] D94541: [OpenMP] Fixed the link error that cannot find static data member

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Tue Jan 12 11:59:52 PST 2021


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, jhuber6.
Herald added subscribers: guansong, yaxunl.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Constant static data member can be defined in the class without another
define after the class in C++17. Although it is C++17, Clang can still handle it
even w/o the flag for C++17. Unluckily, GCC cannot handle that.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D94541

Files:
  openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h


Index: openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h
===================================================================
--- openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h
+++ openmp/libomptarget/plugins/common/MemoryManager/MemoryManager.h
@@ -338,4 +338,9 @@
   }
 };
 
+// GCC still cannot handle the static data member like Clang so we still need
+// this part.
+constexpr const size_t MemoryManagerTy::BucketSize[];
+constexpr const int MemoryManagerTy::NumBuckets;
+
 #endif // LLVM_OPENMP_LIBOMPTARGET_PLUGINS_COMMON_MEMORYMANAGER_MEMORYMANAGER_H


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94541.316188.patch
Type: text/x-patch
Size: 591 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210112/c5f6f6d6/attachment.bin>


More information about the Openmp-commits mailing list