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

            Bug ID: 81045
           Summary: [7 Regression] return type deduction causes template
                    function call failure
           Product: gcc
           Version: 7.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sintendo at gmail dot com
  Target Milestone: ---

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

https://godbolt.org/g/3pXcbe

g++ -std=c++14 bug.cpp

The attached testcase will fail to compile in GCC 7.1.0:

<source>: In member function 'void Group::objects() const':
<source>:46:31: error: expected primary-expression before '>' token
       auto casted = obj.cast<T>();
                               ^
<source>:46:33: error: expected primary-expression before ')' token
       auto casted = obj.cast<T>();
                                 ^

Explicitly stating the return types for vector::begin() and vector::end() will
make the error go away, although I do not think it is necessary in this case.
clang and older GCC versions do not have this problem.

Reply via email to