public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115216] New: operator auto() gets instantiatied too eagerly
@ 2024-05-24 14:20 olaf.krzikalla at dlr dot de
  2024-05-24 14:23 ` [Bug c++/115216] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: olaf.krzikalla at dlr dot de @ 2024-05-24 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115216
           Summary: operator auto() gets instantiatied too eagerly
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olaf.krzikalla at dlr dot de
  Target Milestone: ---

Full example in:

https://godbolt.org/z/3hG5fh1PW

The example can be compiled either by commenting out line 24 or by swapping in
line 8 for line 9. In any case line 25 works. Thus there is a difference
between
the terms "xx[1]" and "xx.operator[](1)".

The error occurs with all recent gcc versions. It doesn't occur with any clang
version.

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

* [Bug c++/115216] operator auto() gets instantiatied too eagerly
  2024-05-24 14:20 [Bug c++/115216] New: operator auto() gets instantiatied too eagerly olaf.krzikalla at dlr dot de
@ 2024-05-24 14:23 ` pinskia at gcc dot gnu.org
  2024-05-24 14:27 ` pinskia at gcc dot gnu.org
  2024-05-28 11:00 ` olaf.krzikalla at dlr dot de
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-24 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 58281
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58281&action=edit
testcase

Next time please attach the testcase or place it inline rather than just a link
to godbolt.

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

* [Bug c++/115216] operator auto() gets instantiatied too eagerly
  2024-05-24 14:20 [Bug c++/115216] New: operator auto() gets instantiatied too eagerly olaf.krzikalla at dlr dot de
  2024-05-24 14:23 ` [Bug c++/115216] " pinskia at gcc dot gnu.org
@ 2024-05-24 14:27 ` pinskia at gcc dot gnu.org
  2024-05-28 11:00 ` olaf.krzikalla at dlr dot de
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-24 14:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MSVC and ICC (EDG in GCC compat mode) also rejects the code for the same reason
as GCC. Are you sure this is not a clang issue?

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

* [Bug c++/115216] operator auto() gets instantiatied too eagerly
  2024-05-24 14:20 [Bug c++/115216] New: operator auto() gets instantiatied too eagerly olaf.krzikalla at dlr dot de
  2024-05-24 14:23 ` [Bug c++/115216] " pinskia at gcc dot gnu.org
  2024-05-24 14:27 ` pinskia at gcc dot gnu.org
@ 2024-05-28 11:00 ` olaf.krzikalla at dlr dot de
  2 siblings, 0 replies; 4+ messages in thread
From: olaf.krzikalla at dlr dot de @ 2024-05-28 11:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Olaf Krzikalla <olaf.krzikalla at dlr dot de> ---
(In reply to Andrew Pinski from comment #2)
> MSVC and ICC (EDG in GCC compat mode) also rejects the code for the same
> reason as GCC. Are you sure this is not a clang issue?

To be honest I don't know. I have no idea, if a compiler is allowed to convert
a type before applying a operator, if there is already such an operator
available in the genuine class. Someone who knows the respective details in the
standard is required.

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

end of thread, other threads:[~2024-05-28 11:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-24 14:20 [Bug c++/115216] New: operator auto() gets instantiatied too eagerly olaf.krzikalla at dlr dot de
2024-05-24 14:23 ` [Bug c++/115216] " pinskia at gcc dot gnu.org
2024-05-24 14:27 ` pinskia at gcc dot gnu.org
2024-05-28 11:00 ` olaf.krzikalla at dlr dot de

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