
This legal code : === struct A { typedef int B; }; typedef A C; C::B i; === is not supported by the standard grammar. "C::" is a nested-name-specifier and then "C" a class-or-namespace-name. But here, it is a typedef name ! I think the grammar should be this : class-or-namespace-name: class-name namespace-name typedef-name -- Valentin David valentin@lrde.epita.fr

This legal code : === struct A { typedef int B; }; typedef A C; C::B i; ===
is not supported by the standard grammar.
Je comprends pas : tu dis "legal" et "not supported by the standard grammar". Pourtant pour moi c'est équivalent, non ?
"C::" is a nested-name-specifier and then "C" a class-or-namespace-name. But here, it is a typedef name !
I think the grammar should be this :
class-or-namespace-name: class-name namespace-name typedef-name

Akim Demaille <akim@epita.fr> writes:
This legal code : === struct A { typedef int B; }; typedef A C; C::B i; ===
is not supported by the standard grammar.
Je comprends pas : tu dis "legal" et "not supported by the standard grammar". Pourtant pour moi c'est équivalent, non ?
Tout les compilateurs le gère, cela va de soit, et ce code "paraît" legal. Même comeau en strict C++ le compile. Et pourtant, dans le std du C++... c'est illégal. "La grammaire parle d'elle-même".
"C::" is a nested-name-specifier and then "C" a class-or-namespace-name. But here, it is a typedef name !
I think the grammar should be this :
class-or-namespace-name: class-name namespace-name typedef-name
-- Valentin David valentin@lrde.epita.fr

Akim Demaille <akim@epita.fr> writes:
This legal code : === struct A { typedef int B; }; typedef A C; C::B i; ===
is not supported by the standard grammar.
Je comprends pas : tu dis "legal" et "not supported by the standard grammar". Pourtant pour moi c'est équivalent, non ?
Tout les compilateurs le gère, cela va de soit, et ce code "paraît" legal. Même comeau en strict C++ le compile. Et pourtant, dans le std du C++... c'est illégal. "La grammaire parle d'elle-même".
Il vaudrait s'assurer qu'on a vraiment qqch d'up to date. Peux-tu poser la question dans un groupe tel que comp.lang.c++.moderated ? Thanks! D'ailleurs, Djo, peut-on ouvrir en local quelques ng importants ?
"C::" is a nested-name-specifier and then "C" a class-or-namespace-name. But here, it is a typedef name !
I think the grammar should be this :
class-or-namespace-name: class-name namespace-name typedef-name
participants (2)
-
Akim Demaille
-
valentin@lrde.epita.fr