Hi Bruno, Two comments.
Bruno Haible <[email protected]> writes: > When compiling GNU clisp with clang++, I see this error: > > .../gllib/string.h:1830:20: error: expected a qualified name after 'typename' > 1830 | template <typename T> T strnul (T); > | ^ > .../clisp.h:6891:12: note: expanded from macro 'T' > 6891 | #define T (object{((oint)&symbol_tab_data.S_t+1UL), alloccount}) > | ^ > > That's because clisp (rightfully) defines T as a macro. It should do so after all other includes, IMO. It's not reasonable to expect headers not to use the identifier 'T' I think. The following example: template<typename T> void foo(); #define T whatever ... has no issues whatsoever with the collision of the identifier 'T' between the template argument and macro, as template processing happens after the preprocessor has already concluded, and does not rely on token stream manipulation. Regarding the commit message: this doesn't really make the templates more hygienic, I think (as templates can't leak the identifier anyway), they just make them not break under the specific "unhygienic" context in clisp itself. > This patch fixes it. > > > 2026-10-11 Bruno Haible <[email protected]> > > Make C++ templates more hygienic. > * lib/math.in.h (isfinite, isinf, isnan, signbit): Rename template > parameter T to _T_. _T_ is a reserved identifier; all identifiers starting with an underscore followed by a capital letter are. See [lex.name]p4.1 (conveniently accessible at [1]). Have a lovely evening. [1] https://eel.is/c++draft/lex.name#4.1 -- Arsen Arsenović
signature.asc
Description: PGP signature
