public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98440] New: Accepts ill-formed reinterpret_cast<int&&>(1)
@ 2020-12-24 21:38 aschepler at gmail dot com
  2020-12-27 20:16 ` [Bug c++/98440] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: aschepler at gmail dot com @ 2020-12-24 21:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98440

            Bug ID: 98440
           Summary: Accepts ill-formed reinterpret_cast<int&&>(1)
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aschepler at gmail dot com
  Target Milestone: ---

g++ does not give any error or warning for a reinterpret_cast when the target
type is an rvalue reference type and the expression operand is a prvalue, for
example reinterpret_cast<int&&>(1).

In standard section [expr.reinterpret.cast], casts to reference types are
described only by paragraph 11, which allows casting a glvalue to a reference
type, but specifically says "No temporary is created". So the temporary
materialization conversion can't be implicitly used like in most expressions,
and the paragraph can't apply.

Clang++, MSVC, and ICC all produce error messages for the expression
reinterpret_cast<int&&>(1).

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-07  9:20 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-24 21:38 [Bug c++/98440] New: Accepts ill-formed reinterpret_cast<int&&>(1) aschepler at gmail dot com
2020-12-27 20:16 ` [Bug c++/98440] " redi at gcc dot gnu.org
2020-12-27 20:19 ` [Bug c++/98440] [9/10/11 Regression] " redi at gcc dot gnu.org
2021-01-14 11:14 ` rguenth at gcc dot gnu.org
2021-04-05 19:46 ` jason at gcc dot gnu.org
2021-04-05 21:27 ` cvs-commit at gcc dot gnu.org
2021-04-05 21:30 ` [Bug c++/98440] [9/10 " jason at gcc dot gnu.org
2021-06-01  8:19 ` rguenth at gcc dot gnu.org
2021-07-27 22:22 ` pinskia at gcc dot gnu.org
2022-05-27  9:44 ` [Bug c++/98440] [10 " rguenth at gcc dot gnu.org
2022-06-28 10:42 ` jakub at gcc dot gnu.org
2023-07-07  9:20 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).