https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89299
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2019-02-12 Ever confirmed|0 |1 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to paradox_ptr from comment #0) > Clearly, template function is still a function, No it isn't, it's a template. > especially when explicitly > instantiated. Well you didn't instantiate it. 'cu' is not a function, it's a template. But it still doesn't compile if you use __attribute__((cleanup(cu<char>))). In theory the compiler could deduce the template arguments from the type of the variable, but IMHO it's completely unnecessary to use this extension in C++ anyway, so adding complexity to it is a waste of resources.