From d6c65cb1dc83d9ce14d174ec8b743406d61b065e Mon Sep 17 00:00:00 2001 From: Eisenwave Date: Thu, 16 Jul 2026 06:47:41 +0200 Subject: [PATCH] [ub:expr.shift.neg.and.width] Use std::uint32_t instead of int in example --- source/ub.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/ub.tex b/source/ub.tex index 96ef0ac1a0..65ed32f733 100644 --- a/source/ub.tex +++ b/source/ub.tex @@ -1281,12 +1281,12 @@ \pnum \begin{example} +The following example assumes that \tcode{std::uint32_t} is supported\iref{cstdint.syn}. \begin{codeblock} -int y = 1 << -1; // undefined behavior, shift is negative +std::uint32_t y = 1 << -1; // undefined behavior, shift is negative -static_assert(sizeof(int) == 4 && CHAR_BIT == 8); -int y1 = 1 << 32; // undefined behavior, shift is equal to the bit width of \tcode{int} -int y2 = 1 >> 32; // undefined behavior, shift is equal to the bit width of \tcode{int} +std::uint32_t y1 = 1 << 32; // undefined behavior, shift is equal to the bit width of \tcode{std::uint32_t} +std::uint32_t y2 = 1 >> 32; // undefined behavior, shift is equal to the bit width of \tcode{std::uint32_t} \end{codeblock} \end{example}