------- Comment #2 from jakub at gcc dot gnu dot org 2008-10-31 10:59 ------- Certainly e.g. cp_parser_cast_expression and cp_parser_postfix_expression could reject types with type_uses_auto, but doesn't [dcl.spec.auto] specify only very limited number of places where auto can be used and the rest: "A program that uses auto in a context not explicitly allowed in this section is ill-formed."? Enumerating all the places which parse types and auto isn't explicitly allowed would be IMHO difficult, wouldn't it be better to add a new flag (say to enum cp_parser_flags, CP_PARSER_FLAGS_AUTO_ALLOWED) and pass it down to cp_parser_type_specifier*? Guess we might still need a type_uses_auto check in a couple of places, but it will be certainly less than if we parse auto all the time and let all the callers check for it. E.g. ATM g++ parses without any errors: #include <typeinfo> const std::type_info &foo () { return typeid (auto); } const std::type_info &bar () { return typeid (auto *); } and returns _ZTIT_ and _ZTIPT_, which looks wrong. BTW, seems a lot of cp_parser_type_specifier* callers still think the flags argument is boolean and pass /*is_condition=*/false or /*is_condition=*/true to it.
-- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dodji at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37962