[Mlir-commits] [clang] [libc] [lldb] [mlir] [llvm] [NFC][ObjectSizeOffset] Use classes instead of std::pair (PR #76882)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Jan 6 14:37:50 PST 2024
dyung wrote:
Hi @bwendling, your change to MemoryBuiltins.h is hitting an error in the version of Visual Studio 2019 that we use internally to build:
```
C:\j\w\779ddbee\p\llvm\include\llvm/Analysis/MemoryBuiltins.h(217): error C2990: 'llvm::SizeOffsetType': non-class template has already been declared as a class template
C:\j\w\779ddbee\p\llvm\include\llvm/Analysis/MemoryBuiltins.h(193): note: see declaration of 'llvm::SizeOffsetType'
C:\j\w\779ddbee\p\llvm\include\llvm/Analysis/MemoryBuiltins.h(279): error C2990: 'llvm::SizeOffsetType': non-class template has already been declared as a class template
C:\j\w\779ddbee\p\llvm\include\llvm/Analysis/MemoryBuiltins.h(193): note: see declaration of 'llvm::SizeOffsetType'
C:\j\w\779ddbee\p\llvm\include\llvm/Analysis/MemoryBuiltins.h(292): error C2990: 'llvm::SizeOffsetType': non-class template has already been declared as a class template
C:\j\w\779ddbee\p\llvm\include\llvm/Analysis/MemoryBuiltins.h(193): note: see declaration of 'llvm::SizeOffsetType'
```
>From the Visual Studio documentation for the error, it appears that we should be able to work around this error by modifying the friend declaration like this:
```c++
- friend class SizeOffsetType;
+ template <typename T, class C> friend class SizeOffsetType;
```
When I made this change to the 3 locations that caused the error (lines 217/279/292), I was able to build successfully with Visual Studio. Could we update the friend declaration so that it also works with the version of Visual Studio that we are using internally to build?
https://github.com/llvm/llvm-project/pull/76882
More information about the Mlir-commits
mailing list