template <auto> void f() { } constexpr auto g = f<[] (int x, int y) { return x > y; }>; This produces the following diagnostic: <source>: In lambda function: <source>:5:50: error: expected ';' before '>' token 5 | constexpr auto g = f<[] (int x, int y) { return x > y; }>; | ^~ | ; <source>:5:51: error: expected primary-expression before '>' token 5 | constexpr auto g = f<[] (int x, int y) { return x > y; }>; | ^ ASM generation compiler returned: 1 <source>: In lambda function: <source>:5:50: error: expected ';' before '>' token 5 | constexpr auto g = f<[] (int x, int y) { return x > y; }>; | ^~ | ; <source>:5:51: error: expected primary-expression before '>' token 5 | constexpr auto g = f<[] (int x, int y) { return x > y; }>; | ^ Godbolt link to the above: https://godbolt.org/z/KG6d5E6ev Changing the body to return (x > y); makes the error go away as a workaround. So I speculate that the greater-than operator is misparsed as the end of the template argument list.
I suspect this is the same issue as PR 57 .
Even template defaults has issues: template <auto = [] (int x, int y) { return x > y; }> int t = 0; Which is why I Pointed to PR 57.
I wonder if this is still an ambiguous part of the C++ grammar and all.
It seems that the core of PR 57 is that `A<T` could syntactically be a valid expression, and it would require a look-up to determine that A and T are in fact a template and a type, and not values. Here, however, the fragment `[] (int x, int y) { return x` doesn't form a syntactically valid expression. So, to me at least, it seems there should be no ambiguity.