From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C0F74386197F; Mon, 21 Sep 2020 08:38:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C0F74386197F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1600677491; bh=flQ0tDxir4RmllWSOJl0FURjByCz7CpGiCwwvzdLHI0=; h=From:To:Subject:Date:In-Reply-To:References:From; b=eeO3wbRzBUbgFQi3rDDj//AiTU4+6YCSBhDH4+bfAS4egg1NbRDxLC9isXygH60O3 Tjs7PNZbyDfRNiQ53QOdyt045WmiZtR27etnts+/S8l2jsshgR38evYSyT4T68Wf+Y +z2vMgIEbXX5+lEeRfiEOtjMA2D7qNwZFzA1tGd4= From: "fsb4000 at yandex dot ru" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/97132] assume_aligned is not constexpr Date: Mon, 21 Sep 2020 08:38:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: rejects-valid X-Bugzilla-Severity: normal X-Bugzilla-Who: fsb4000 at yandex dot ru X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Sep 2020 08:38:11 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97132 --- Comment #4 from fsb4000 at yandex dot ru --- (In reply to Jonathan Wakely from comment #3) > I'll test this: >=20 > { > static_assert(std::has_single_bit(_Align)); > _GLIBCXX_DEBUG_ASSERT((std::uintptr_t)__ptr % _Align =3D=3D 0); > - return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Align)); > + if (std::is_constant_evaluated()) > + return __ptr; > + else > + return static_cast<_Tp*>(__builtin_assume_aligned(__ptr, _Align)); > } > #endif // C++2a Yes, should be fine.=20 We do same for Microsoft STL.=