Closed
Description
Describe the bug
I think anonymous functions should never be forward declared, and IMHO decltype should not be implied for them when using inside a type alias (and possibly other scenarios as well)
currently there's no usable equivalent to the cpp1 syntax for this that works
using pq_conn_ptr = std::unique_ptr<PGconn, decltype([](PGconn *ptr) { PQfinish(ptr); })>;
To Reproduce
Steps to reproduce the behavior:
- Sample code - distilled down to minimal essentials please
I tried this instead
pq_conn_ptr : type == std::unique_ptr<PGconn, decltype(: (ptr : *PGconn) = { PQfinish(ptr); })>;
and using it just as
p: pq_conn_ptr = (); - Command lines including which C++ compiler you are using
cppfront and g++-13 but I guess the issue would be with any compiler cause it's caused by the generated code - Expected result - what you expected to happen
I expected it to generate the above using declaration - Actual result/error
using pq_conn_ptr = std::unique_ptr<PGconn,decltype([](PGconn* ptr) -> void;)>;
the error is that the body of the lambda is missing