[libc-commits] [libc] 6504b15 - [libc][NFC] Mark some methods constexpr

Alex Brachet via libc-commits libc-commits at lists.llvm.org
Wed Jun 8 15:41:15 PDT 2022


Author: Alex Brachet
Date: 2022-06-08T22:41:09Z
New Revision: 6504b159926832db7f4f93271cfa1bf19c829a97

URL: https://github.com/llvm/llvm-project/commit/6504b159926832db7f4f93271cfa1bf19c829a97
DIFF: https://github.com/llvm/llvm-project/commit/6504b159926832db7f4f93271cfa1bf19c829a97.diff

LOG: [libc][NFC] Mark some methods constexpr

gcc is complaining that these methods are being called
from a function that is marked constexpr but these
aren't.

Added: 
    

Modified: 
    libc/src/__support/CPP/UInt.h

Removed: 
    


################################################################################
diff  --git a/libc/src/__support/CPP/UInt.h b/libc/src/__support/CPP/UInt.h
index 00342b2bf4fb..87defdd4f98b 100644
--- a/libc/src/__support/CPP/UInt.h
+++ b/libc/src/__support/CPP/UInt.h
@@ -278,10 +278,10 @@ template <size_t Bits> class UInt {
   }
 
   // Return the i-th 64-bit word of the number.
-  const uint64_t &operator[](size_t i) const { return val[i]; }
+  constexpr const uint64_t &operator[](size_t i) const { return val[i]; }
 
   // Return the i-th 64-bit word of the number.
-  uint64_t &operator[](size_t i) { return val[i]; }
+  constexpr uint64_t &operator[](size_t i) { return val[i]; }
 
   uint64_t *data() { return val; }
 


        


More information about the libc-commits mailing list