public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113523] New: A conversion function template can have a deduced return type
@ 2024-01-20 11:52 fchelnokov at gmail dot com
  2024-01-23 21:01 ` [Bug c++/113523] " mpolacek at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: fchelnokov at gmail dot com @ 2024-01-20 11:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 113523
           Summary: A conversion function template can have a deduced
                    return type
           Product: gcc
           Version: 13.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

Contrary to https://timsong-cpp.github.io/cppwp/n4861/class.conv.fct#6, GCC
allows  a conversion function template with a deduced return type:


struct A {
    template<class=void>
    constexpr operator auto() const { return 1; }
};

constexpr int f() {
    return A{}.template operator auto();
}

static_assert( f() == 1 );


Online demo: https://godbolt.org/z/s8oK6rnPY

In addition, the diagnostics "warning: use of 'auto' in member template
conversion operator can never be deduced" seems wrong.

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

* [Bug c++/113523] A conversion function template can have a deduced return type
  2024-01-20 11:52 [Bug c++/113523] New: A conversion function template can have a deduced return type fchelnokov at gmail dot com
@ 2024-01-23 21:01 ` mpolacek at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-01-23 21:01 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-01-23
     Ever confirmed|0                           |1
           Keywords|                            |accepts-invalid
                 CC|                            |mpolacek at gcc dot gnu.org
             Blocks|                            |94404
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.  This is https://cplusplus.github.io/CWG/issues/1878.html


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94404
[Bug 94404] [meta-bug] C++ core issues

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

end of thread, other threads:[~2024-01-23 21:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-20 11:52 [Bug c++/113523] New: A conversion function template can have a deduced return type fchelnokov at gmail dot com
2024-01-23 21:01 ` [Bug c++/113523] " mpolacek 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).