[llvm] 1c11c60 - Fix MSVC compile error in BitstreamRemarkParser.h when targeting C++17

Justin Holewinski via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 17 07:23:51 PDT 2025


Author: Justin Holewinski
Date: 2025-10-17T07:22:58-07:00
New Revision: 1c11c6004c820bf43eb2356da93e7bc8cb38f51e

URL: https://github.com/llvm/llvm-project/commit/1c11c6004c820bf43eb2356da93e7bc8cb38f51e
DIFF: https://github.com/llvm/llvm-project/commit/1c11c6004c820bf43eb2356da93e7bc8cb38f51e.diff

LOG: Fix MSVC compile error in BitstreamRemarkParser.h when targeting C++17

The following errors are seen in our builds using MSVC 2022:

BitstreamRemarkParser.h(115): error C2990: 'llvm::remarks::BitstreamBlockParserHelper': non-class template has already been declared as a class template
BitstreamRemarkParser.h(66): note: see declaration of 'llvm::remarks::BitstreamBlockParserHelper'

This change fixes the build issue by adding an explicit template
argument to the `friend class` statements.

This issue is not seen if using `-std:c++20`, but we still support
building as C++17.

Added: 
    

Modified: 
    llvm/lib/Remarks/BitstreamRemarkParser.h

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Remarks/BitstreamRemarkParser.h b/llvm/lib/Remarks/BitstreamRemarkParser.h
index 4f66c47bb4b29..914edd8961290 100644
--- a/llvm/lib/Remarks/BitstreamRemarkParser.h
+++ b/llvm/lib/Remarks/BitstreamRemarkParser.h
@@ -112,7 +112,7 @@ class BitstreamBlockParserHelper : public BitstreamBlockParserHelperBase {
 /// Helper to parse a META_BLOCK for a bitstream remark container.
 class BitstreamMetaParserHelper
     : public BitstreamBlockParserHelper<BitstreamMetaParserHelper> {
-  friend class BitstreamBlockParserHelper;
+  friend class BitstreamBlockParserHelper<BitstreamMetaParserHelper>;
 
 public:
   struct ContainerInfo {
@@ -137,7 +137,7 @@ class BitstreamMetaParserHelper
 /// Helper to parse a REMARK_BLOCK for a bitstream remark container.
 class BitstreamRemarkParserHelper
     : public BitstreamBlockParserHelper<BitstreamRemarkParserHelper> {
-  friend class BitstreamBlockParserHelper;
+  friend class BitstreamBlockParserHelper<BitstreamRemarkParserHelper>;
 
 protected:
   SmallVector<uint64_t, 5> Record;


        


More information about the llvm-commits mailing list