| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 039da01 commit b433693
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -100,7 +100,7 @@ outer: @print type = { | |||
| 100 | 100 | all: <Args...: type> (args...: Args) -> bool = | |
| 101 | 101 | (... && args); | |
| 102 | 102 | ||
| 103 | - y: (_: decltype(0)) = { } | ||
| 103 | + y: (_: type_of(0)) = { } | ||
| 104 | 104 | ||
| 105 | 105 | } | |
| 106 | 106 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -72,7 +72,7 @@ CPP2_REQUIRES_ (cpp2::impl::cmp_greater_eq(sizeof...(Args),0u)) ; | |||
| 72 | 72 | public: template<typename ...Args> [[nodiscard]] static auto all(Args const& ...args) -> bool; | |
| 73 | 73 | ||
| 74 | 74 | #line 103 "pure2-print.cpp2" | |
| 75 | - public: static auto y([[maybe_unused]] cpp2::impl::in<decltype(0)> unnamed_param_1) -> void; | ||
| 75 | + public: static auto y([[maybe_unused]] cpp2::impl::in<CPP2_TYPEOF(0)> unnamed_param_1) -> void; | ||
| 76 | 76 | public: outer() = default; | |
| 77 | 77 | public: outer(outer const&) = delete; /* No 'that' constructor, suppress copy */ | |
| 78 | 78 | public: auto operator=(outer const&) -> void = delete; | |
@@ -203,7 +203,7 @@ requires (cpp2::impl::cmp_greater_eq(sizeof...(Args),0u)) { | |||
| 203 | 203 | return (... && args); } | |
| 204 | 204 | ||
| 205 | 205 | #line 103 "pure2-print.cpp2" | |
| 206 | - auto outer::y([[maybe_unused]] cpp2::impl::in<decltype(0)> unnamed_param_1) -> void{} | ||
| 206 | + auto outer::y([[maybe_unused]] cpp2::impl::in<CPP2_TYPEOF(0)> unnamed_param_1) -> void{} | ||
| 207 | 207 | ||
| 208 | 208 | #line 107 "pure2-print.cpp2" | |
| 209 | 209 | auto main() -> int{ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -147,7 +147,7 @@ outer:/* @print */ type = | |||
| 147 | 147 | ||
| 148 | 148 | all: <Args...: type, >(in args...: Args, ) -> move bool = (... && args); | |
| 149 | 149 | ||
| 150 | - y:(in _: decltype(0), ) = | ||
| 150 | + y:(in _: type_of(0), ) = | ||
| 151 | 151 | { | |
| 152 | 152 | } | |
| 153 | 153 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1389,7 +1389,7 @@ struct type_id_node | |||
| 1389 | 1389 | int dereference_cnt = {}; | |
| 1390 | 1390 | token const* suspicious_initialization = {}; | |
| 1391 | 1391 | ||
| 1392 | - enum active : u8 { empty=0, decltype_, qualified, unqualified, function, keyword }; | ||
| 1392 | + enum active : u8 { empty=0, postfix, qualified, unqualified, function, keyword }; | ||
| 1393 | 1393 | std::variant< | |
| 1394 | 1394 | std::monostate, | |
| 1395 | 1395 | std::unique_ptr<postfix_expression_node>, | |
@@ -1460,7 +1460,7 @@ struct type_id_node | |||
| 1460 | 1460 | switch (id.index()) { | |
| 1461 | 1461 | break;case empty: | |
| 1462 | 1462 | return {}; | |
| 1463 | - break;case decltype_: | ||
| 1463 | + break;case postfix: | ||
| 1464 | 1464 | return {}; | |
| 1465 | 1465 | break;case qualified: | |
| 1466 | 1466 | return {}; | |
@@ -1490,7 +1490,7 @@ struct type_id_node | |||
| 1490 | 1490 | for (auto q : pc_qualifiers) { | |
| 1491 | 1491 | v.start(*q, depth+1); | |
| 1492 | 1492 | } | |
| 1493 | - try_visit<decltype_ >(id, v, depth); | ||
| 1493 | + try_visit<postfix >(id, v, depth); | ||
| 1494 | 1494 | try_visit<qualified >(id, v, depth); | |
| 1495 | 1495 | try_visit<unqualified>(id, v, depth); | |
| 1496 | 1496 | try_visit<function >(id, v, depth); | |
@@ -2825,8 +2825,8 @@ auto type_id_node::to_string() const | |||
| 2825 | 2825 | switch (id.index()) { | |
| 2826 | 2826 | break;case empty: | |
| 2827 | 2827 | 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(); | ||
| 2830 | 2830 | break;case qualified: | |
| 2831 | 2831 | ret += std::get<qualified>(id)->to_string(); | |
| 2832 | 2832 | break;case unqualified: | |
@@ -5157,7 +5157,7 @@ auto pretty_print_visualize(type_id_node const& n, int indent) | |||
| 5157 | 5157 | } | |
| 5158 | 5158 | ||
| 5159 | 5159 | 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); | ||
| 5161 | 5161 | ret += try_pretty_print_visualize<type_id_node::qualified >(n.id, indent); | |
| 5162 | 5162 | ret += try_pretty_print_visualize<type_id_node::unqualified>(n.id, indent); | |
| 5163 | 5163 | ret += try_pretty_print_visualize<type_id_node::function >(n.id, indent); | |
@@ -6941,6 +6941,7 @@ class parser | |||
| 6941 | 6941 | ||
| 6942 | 6942 | ||
| 6943 | 6943 | //G type-id: | |
| 6944 | + //G type-qualifier-seq? 'type_of' '(' expression ')' is-type-constraint? | ||
| 6944 | 6945 | //G type-qualifier-seq? 'decltype' '(' expression ')' is-type-constraint? | |
| 6945 | 6946 | //G type-qualifier-seq? qualified-id is-type-constraint? | |
| 6946 | 6947 | //G type-qualifier-seq? unqualified-id is-type-constraint? | |
@@ -6985,11 +6986,13 @@ class parser | |||
| 6985 | 6986 | } | |
| 6986 | 6987 | ||
| 6987 | 6988 | if (auto& c = curr(); | |
| 6988 | - c == "decltype" | ||
| 6989 | + c == "type_of" | ||
| 6990 | + || c == "decltype" | ||
| 6989 | 6991 | ) | |
| 6990 | 6992 | { | |
| 6991 | 6993 | if ( | |
| 6992 | - peek(1) && peek(1)->type() == lexeme::LeftParen | ||
| 6994 | + c == "decltype" | ||
| 6995 | + && peek(1) && peek(1)->type() == lexeme::LeftParen | ||
| 6993 | 6996 | && peek(2) && *peek(2) == "auto" | |
| 6994 | 6997 | && peek(3) && peek(3)->type() == lexeme::RightParen) | |
| 6995 | 6998 | { | |
@@ -7008,11 +7011,11 @@ class parser | |||
| 7008 | 7011 | { | |
| 7009 | 7012 | n->pos = id->position(); | |
| 7010 | 7013 | n->id = std::move(id); | |
| 7011 | - assert (n->id.index() == type_id_node::decltype_); | ||
| 7014 | + assert (n->id.index() == type_id_node::postfix); | ||
| 7012 | 7015 | } | |
| 7013 | 7016 | else | |
| 7014 | 7017 | { | |
| 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()); | ||
| 7016 | 7019 | return {}; | |
| 7017 | 7020 | } | |
| 7018 | 7021 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1939,7 +1939,7 @@ class cppfront | |||
| 1939 | 1939 | printer.print_cpp2("auto", pos); | |
| 1940 | 1940 | } | |
| 1941 | 1941 | else { | |
| 1942 | - try_emit<type_id_node::decltype_ >(n.id); | ||
| 1942 | + try_emit<type_id_node::postfix >(n.id); | ||
| 1943 | 1943 | try_emit<type_id_node::unqualified>(n.id, 0, false); | |
| 1944 | 1944 | try_emit<type_id_node::qualified >(n.id); | |
| 1945 | 1945 | try_emit<type_id_node::keyword >(n.id); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments