public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114561] New: Comma operator with forwarding reference to pointer raises invalid lvalue required error
@ 2024-04-02 10:06 Liam.Jackson@qa-systems.com
  2024-04-02 11:08 ` [Bug c++/114561] " redi at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Liam.Jackson@qa-systems.com @ 2024-04-02 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114561
           Summary: Comma operator with forwarding reference to pointer
                    raises invalid lvalue required error
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Liam.Jackson@qa-systems.com
  Target Milestone: ---

Created attachment 57845
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57845&action=edit
Source to reproduce bug

Compiling the attached source (cut down example) with `g++ -c fail.cpp` raises
the following error:

fail.cpp: In instantiation of ‘static T Create<T>::create(U&&) [with U = void*
const&; T = MyClass]’:
fail.cpp:38:28:   required from here
fail.cpp:31:12: error: lvalue required as unary ‘&’ operand
   31 |     return T( ( (beforeParam()), (forward<U>(u)) ) );
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


This code is expected to compile correctly. There is no unary '&' operator in
use.

This seems to be caused by a combination of using the comma operator and
calling `create` with a pointer variable (using nullptr directly compiles, as
shown in the code comment).

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

end of thread, other threads:[~2024-05-24 13:42 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-02 10:06 [Bug c++/114561] New: Comma operator with forwarding reference to pointer raises invalid lvalue required error Liam.Jackson@qa-systems.com
2024-04-02 11:08 ` [Bug c++/114561] " redi at gcc dot gnu.org
2024-04-02 11:28 ` redi at gcc dot gnu.org
2024-04-02 11:33 ` redi at gcc dot gnu.org
2024-04-02 11:35 ` redi at gcc dot gnu.org
2024-04-02 14:38 ` [Bug c++/114561] [11/12/13/14 Regression] Comma operator with forwarding reference to pointer raises invalid lvalue required error since r10-7410 jakub at gcc dot gnu.org
2024-04-02 14:38 ` jakub at gcc dot gnu.org
2024-04-02 14:45 ` jason at gcc dot gnu.org
2024-04-02 18:11 ` cvs-commit at gcc dot gnu.org
2024-05-01 20:31 ` [Bug c++/114561] [11/12/13 " cvs-commit at gcc dot gnu.org
2024-05-24 13:26 ` [Bug c++/114561] [11/12 " cvs-commit at gcc dot gnu.org
2024-05-24 13:27 ` cvs-commit at gcc dot gnu.org
2024-05-24 13:29 ` jason at gcc dot gnu.org
2024-05-24 13:42 ` Liam.Jackson@qa-systems.com

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).