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]

Reply via email to