public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64969] New: generic functions do not work with placeholder return types
@ 2015-02-07 15:33 rs2740 at gmail dot com
  2015-02-13 12:04 ` [Bug c++/64969] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rs2740 at gmail dot com @ 2015-02-07 15:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64969
           Summary: generic functions do not work with placeholder return
                    types
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rs2740 at gmail dot com

GCC 4.9 added generic functions based on the draft Concepts Lite TS N3889.
(They now called abbreviated function templates.) However, the implementation
does not work with placeholder return types (including both deduced ones and
trailing return types).

For example, all three declarations

auto f1(auto x) { return x++; }
decltype(auto) f2(auto x) { return x++; }
auto f3(auto x) -> int { return x++; }

are apparently treated as if they were equivalent to

template<class T>
T f1(T x) { return x++; }
// etc.

rather than 

template<class T>
auto f1(T x) { return x++; }
// etc.

This is easily observable with

struct X {
    int operator++(int) const { return 0; }
};

f1(X());

which does not compile, complaining that int cannot be converted to X.


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

end of thread, other threads:[~2015-07-25  7:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-07 15:33 [Bug c++/64969] New: generic functions do not work with placeholder return types rs2740 at gmail dot com
2015-02-13 12:04 ` [Bug c++/64969] " redi at gcc dot gnu.org
2015-02-13 12:07 ` redi at gcc dot gnu.org
2015-02-20 11:24 ` harald at gigawatt dot nl
2015-07-25  7:14 ` jason at gcc dot gnu.org
2015-07-25  7:15 ` jason 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).