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

* [Bug c++/65308] [C++14] auto-returning function template used inside function template doesn't allow template members to be called
  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 ` 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
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-04 11:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-04
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It compiles OK if you change it to:

  make_thing<int>().template func<int>();

which I would have thought is necessary, but EDG and Clang don't require it.

Maybe there's some defect report that changed whether the "template" keyword is
required there, and G++ doesn't implement that yet.


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

* [Bug c++/65308] [C++14] auto-returning function template used inside function template doesn't allow template members to be called
  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
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-04 11:36 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Actually no, the 'template' keyword is not required there, but maybe G++ is
confused into thinking that the expression is dependent because of the deduced
return type for make_thing<int>()


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

* [Bug c++/65308] [C++14] auto-returning function template used inside function template doesn't allow template members to be called
  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
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-07 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|NEW                         |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Looks like this same bug was reported much later as PR81045 and fixed for GCC 8
and 7.2.  Thanks for the bug report and ping.

*** This bug has been marked as a duplicate of bug 81045 ***

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