I am arguing that code should be not compiling. Not the opposite.

https://godbolt.org/z/d13x5fr9G

basic_char_traits<void***> is illegal of course. Repeat: I am arguing that code should be not compiling. But it does and there are no warnings whatsoever.

The only two switches used are -pedantic and -Wall. So who do we blame: the compiler or the messenger (aka coder) or both?

Or somebody explains that code compiling and being allowed is fine, because of some higher logic that escapes me... Why am I allowed to declare fake types from std:: templates?


On Fri, 27 Aug 2021 at 14:09, Edward Catmur via Std-Proposals <std-proposals@lists.isocpp.org> wrote:


On Fri, 27 Aug 2021 at 12:30, Giuseppe D'Angelo via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On 27/08/2021 13:09, DBJ via Std-Proposals wrote:
> Thanks, Lenard, I just find it generally peculiar nobody in this
> honorable forum seem genuinely perturbed
>
> This code <https://godbolt.org/z/84TK41c3P>
>
> is legal...? Perhaps there is something obvious escaping my cognitive
> abilities...

That code isn't legal, specifically

#define typename(T_) (#T_)

violates https://eel.is/c++draft/macro.names#2 as typename is a keyword.
https://eel.is/c++draft/tab:lex.key

Ignoring that (as the program seems to be unaffected by its removal), the program is ill-formed because basic_char_traits<void***> is not specialized (and cannot be specialized) and so does not meet the character traits requirements. http://eel.is/c++draft/string.view.template#general-1 

--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals