public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65308] New: [C++14] auto-returning function template used inside function template has problems with being assigned to auto
@ 2015-03-04 10:11 jvp4846 at g dot rit.edu
  2015-03-04 11:34 ` [Bug c++/65308] [C++14] auto-returning function template used inside function template doesn't allow template members to be called redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jvp4846 at g dot rit.edu @ 2015-03-04 10:11 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65308
           Summary: [C++14] auto-returning function template used inside
                    function template has problems with being assigned to
                    auto
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jvp4846 at g dot rit.edu

Created attachment 34945
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34945&action=edit
Sample

I'm 99% sure this is valid C++14, but there's always the chance I misunderstood
something. If you call a function template (`make_thing` in the sample) that
returns auto from another function template (`foo` in the sample), and try to
use a template member function from that return value, GCC emits the following
diagnostic:

  test.cpp: In function 'void foo()':
  test.cpp:12:26: error: expected primary-expression before 'int'
     make_thing<int>().func<int>();

This error doesn't occur if `make_thing` is defined to return `thing`, or if
`make_thing` is not a template, or if `foo` is not a template. Adding
`template` before the call to `func` also fixes this, but that shouldn't be
necessary.

I've reproduced this under GCC 4.9.2 and the GCC 5.0 snapshot from Debian. Here
are their exact versions:

  g++ (Ubuntu 4.9.2-0ubuntu1~14.04) 4.9.2

  g++ (Debian 20150225-1) 5.0.0 20150225 (experimental) [trunk revision 220970]


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

end of thread, other threads:[~2022-01-07 19:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 10:11 [Bug c++/65308] New: [C++14] auto-returning function template used inside function template has problems with being assigned to auto jvp4846 at g dot rit.edu
2015-03-04 11:34 ` [Bug c++/65308] [C++14] auto-returning function template used inside function template doesn't allow template members to be called redi at gcc dot gnu.org
2015-03-04 11:36 ` redi at gcc dot gnu.org
2022-01-07 19:37 ` ppalka 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).