[Bug c++/103213] New: Lambda type name overlap

mario.demontis at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Nov 12 13:41:25 GMT 2021


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

            Bug ID: 103213
           Summary: Lambda type name overlap
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mario.demontis at gmail dot com
  Target Milestone: ---

/******************* BEGIN SOURCE *******************/
template<typename T>
struct Wrap{
        T w;
};

int main() {
        auto l1 = [x = 5](int a){return x+a;};
        auto l2 = [y = 6](int a){return y+1;};
        Wrap<decltype(l1)> w1{l1};
        Wrap<decltype(l2)> w2{l2};
}
/******************** END SOURCE ********************/
Both w1 and w2 are assigned type name Wrap<main()::<lambda(int)> >
In gdb there is no way to distinguish between the 2 types:
(gdb) ptype 'Wrap<main()::<lambda(int)> >'
type = struct Wrap<main()::<lambda(int)> > {
    struct {
        int __x;
    } w;
}
For the same reason, there is also no way to obtain the 2 different python
gdb.Type objects


More information about the Gcc-bugs mailing list