[Bug c++/102590] structured binding inside for all loop thinks it is type depedent when it is not.

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 5 05:41:42 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |rejects-valid
            Summary|Templated operations on     |structured binding inside
                   |variables in structured     |for all loop thinks it is
                   |binding don't work when     |type depedent when it is
                   |templated functions/lambdas |not.
                   |require type deduction      |
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-10-05

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase (without any includes):
struct Foo
{
    template<class T> T get() const { return 0;  }
};

struct f
{
  int t;
  Foo t1;
};

template<typename T>
void error_func(T elem)
{
    f arr[1];
    for(const auto& [_, val] : arr)
    {
        val.get<int>(); // Error here
    }
}


More information about the Gcc-bugs mailing list