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

--- Comment #1 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
Here's a more interesting example: https://godbolt.org/z/83c36q


#include <iostream>

constexpr char f(...) { return 'g'; }
constexpr decltype(auto) f_adl(auto a) { return f(a); }

namespace A {
    constexpr char f(auto) { return 'A'; }
    template<char TemplateParam = f_adl([]{})> void g(char FunctionParam =
f_adl([]{})) {
        char Local = f_adl([]{});
        std::cout << TemplateParam << FunctionParam << Local;
    }
}

namespace B {
    constexpr char f(auto) { return 'B'; }
    void call() { A::g(); }
}

int main() { B::call(); }


This prints 'BgA', but should print 'AAA'. So the three lambdas actually
exhibit three different behaviors, not two.
  • [Bug c++/99209] New:... richard-gccbugzilla at metafoo dot co.uk via Gcc-bugs
    • [Bug c++/99209]... richard-gccbugzilla at metafoo dot co.uk via Gcc-bugs
    • [Bug c++/99209]... mpolacek at gcc dot gnu.org via Gcc-bugs

Reply via email to