[Bug c++/81045] [7 Regression] return type deduction causes dependent types?

daniel.kruegler at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sat Jun 10 14:20:00 GMT 2017


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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
(In reply to Andrew Pinski from comment #1)
> Somehow GCC is deciding that easyObjects->begin() and end() are dependent
> types so you need to use the template keyword for the call to cast.
> 
> That is:
> auto casted = obj.template cast<T>();
> 
> I don't know if GCC is correct here or not.

It looks like a GCC bug to me, because easyObjects is a non-dependent
expression and the specification of the range-for loop doesn't result in a
dependent expression of obj given the participating begin()/end() members.

It should be noted that the demo code is broken, because it incorrectly
attempts to bind an rvalue (The result of vector<>::get) to an lvalue
reference, but that is another story.


More information about the Gcc-bugs mailing list