@@ -1389,7 +1389,7 @@ struct type_id_node
13891389 int dereference_cnt = {};
13901390 token const * suspicious_initialization = {};
13911391
1392- enum active : u8 { empty=0 , decltype_ , qualified, unqualified, function, keyword };
1392+ enum active : u8 { empty=0 , postfix , qualified, unqualified, function, keyword };
13931393 std::variant<
13941394 std::monostate,
13951395 std::unique_ptr<postfix_expression_node>,
@@ -1460,7 +1460,7 @@ struct type_id_node
14601460 switch (id.index ()) {
14611461 break ;case empty:
14621462 return {};
1463- break ;case decltype_ :
1463+ break ;case postfix :
14641464 return {};
14651465 break ;case qualified:
14661466 return {};
@@ -1490,7 +1490,7 @@ struct type_id_node
14901490 for (auto q : pc_qualifiers) {
14911491 v.start (*q, depth+1 );
14921492 }
1493- try_visit<decltype_ >(id, v, depth);
1493+ try_visit<postfix >(id, v, depth);
14941494 try_visit<qualified >(id, v, depth);
14951495 try_visit<unqualified>(id, v, depth);
14961496 try_visit<function >(id, v, depth);
@@ -2825,8 +2825,8 @@ auto type_id_node::to_string() const
28252825 switch (id.index ()) {
28262826 break ;case empty:
28272827 ret += " _" ;
2828- break ;case decltype_ :
2829- ret += std::get<decltype_ >(id)->to_string ();
2828+ break ;case postfix :
2829+ ret += std::get<postfix >(id)->to_string ();
28302830 break ;case qualified:
28312831 ret += std::get<qualified>(id)->to_string ();
28322832 break ;case unqualified:
@@ -5157,7 +5157,7 @@ auto pretty_print_visualize(type_id_node const& n, int indent)
51575157 }
51585158
51595159 if (n.id .index () == type_id_node::empty) { ret += " _" ; }
5160- ret += try_pretty_print_visualize<type_id_node::decltype_ >(n.id , indent);
5160+ ret += try_pretty_print_visualize<type_id_node::postfix >(n.id , indent);
51615161 ret += try_pretty_print_visualize<type_id_node::qualified >(n.id , indent);
51625162 ret += try_pretty_print_visualize<type_id_node::unqualified>(n.id , indent);
51635163 ret += try_pretty_print_visualize<type_id_node::function >(n.id , indent);
@@ -6941,6 +6941,7 @@ class parser
69416941
69426942
69436943 // G type-id:
6944+ // G type-qualifier-seq? 'type_of' '(' expression ')' is-type-constraint?
69446945 // G type-qualifier-seq? 'decltype' '(' expression ')' is-type-constraint?
69456946 // G type-qualifier-seq? qualified-id is-type-constraint?
69466947 // G type-qualifier-seq? unqualified-id is-type-constraint?
@@ -6985,11 +6986,13 @@ class parser
69856986 }
69866987
69876988 if (auto & c = curr ();
6988- c == " decltype"
6989+ c == " type_of"
6990+ || c == " decltype"
69896991 )
69906992 {
69916993 if (
6992- peek (1 ) && peek (1 )->type () == lexeme::LeftParen
6994+ c == " decltype"
6995+ && peek (1 ) && peek (1 )->type () == lexeme::LeftParen
69936996 && peek (2 ) && *peek (2 ) == " auto"
69946997 && peek (3 ) && peek (3 )->type () == lexeme::RightParen)
69956998 {
@@ -7008,11 +7011,11 @@ class parser
70087011 {
70097012 n->pos = id->position ();
70107013 n->id = std::move (id);
7011- assert (n->id .index () == type_id_node::decltype_ );
7014+ assert (n->id .index () == type_id_node::postfix );
70127015 }
70137016 else
70147017 {
7015- error (" 'decltype ' must be followed by a single parenthesized expression" , false , c.position ());
7018+ error (" '" + std::string{c} + " ' must be followed by a single parenthesized expression" , false , c.position ());
70167019 return {};
70177020 }
70187021 }
0 commit comments