Skip to content

Commit d5894a4

Browse files
committed
Handle ::from for unsigned inputs
1 parent 1445cfb commit d5894a4

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/lib/AST/Interp/IntegralAP.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ template <bool Signed> class IntegralAP final {
8282

8383
template <unsigned Bits, bool InputSigned>
8484
static IntegralAP from(Integral<Bits, InputSigned> I) {
85-
assert(InputSigned);
86-
/// FIXME: Take bits parameter.
85+
// FIXME: Take bits parameter.
8786
APSInt Copy =
8887
APSInt(APInt(128, static_cast<int64_t>(I), InputSigned), !Signed);
8988
Copy.setIsSigned(Signed);

clang/test/AST/Interp/literals.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ namespace i128 {
4848
// expected-note {{outside the range}} \
4949
// ref-error {{must be initialized by a constant expression}} \
5050
// ref-note {{outside the range}}
51+
constexpr int128_t Two = (int128_t)1 << 1ul;
52+
static_assert(Two == 2, "");
5153
}
5254

5355
constexpr bool b = number;

0 commit comments

Comments
 (0)