Skip to content

Commit 008bbe2

Browse files
authored
Merge pull request #60637 from etcwilde/ewilde/add-missing-constexprs
Add `FlagSet::getField` constexpr annotation
2 parents ebcb37f + 22ddee9 commit 008bbe2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/swift/Basic/FlagSet.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class FlagSet {
6666

6767
/// Read a multi-bit field.
6868
template <unsigned FirstBit, unsigned BitWidth, typename FieldType = IntType>
69-
FieldType getField() const {
69+
constexpr FieldType getField() const {
7070
return FieldType((Bits >> FirstBit) & lowMaskFor<BitWidth>());
7171
}
7272

@@ -92,7 +92,7 @@ class FlagSet {
9292
// A convenient macro for defining a getter and setter for a field.
9393
// Intended to be used in the body of a subclass of FlagSet.
9494
#define FLAGSET_DEFINE_FIELD_ACCESSORS(BIT, WIDTH, TYPE, GETTER, SETTER) \
95-
TYPE GETTER() const { \
95+
constexpr TYPE GETTER() const { \
9696
return this->template getField<BIT, WIDTH, TYPE>(); \
9797
} \
9898
void SETTER(TYPE value) { \

0 commit comments

Comments
 (0)