[clang] [lldb] [mlir] [llvm] [libc] [NFC][ObjectSizeOffset] Use classes instead of std::pair (PR #76882)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 7 03:40:18 PST 2024


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

Sorry about that. I pushed a fix here:

To https://github.com/llvm/llvm-project.git
   3eb9fd8ac8bb..0903d992cc96  main -> main


https://github.com/llvm/llvm-project/pull/76882


More information about the cfe-commits mailing list