Skip to content

Commit 8472824

Browse files
committed
Switch alternative spelling mangling to cpp2_ prefix, closes #328 again
1 parent dd8f668 commit 8472824

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

source/cppfront.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ class cppfront
14701470
|| n == "xor_eq"
14711471
)
14721472
{
1473-
printer.print_cpp2(n.to_string(true) + "_", pos);
1473+
printer.print_cpp2("cpp2_"+n.to_string(true), pos);
14741474
}
14751475
else if (
14761476
current_declarations.back()

source/parse.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5205,21 +5205,25 @@ class parser
52055205

52065206
// deduced_type == true means that the type will be deduced,
52075207
// represented using an empty type-id
5208-
if (deduced_type) {
5208+
if (
5209+
deduced_type
5210+
&& peek(1)
5211+
)
5212+
{
52095213
auto& type = std::get<declaration_node::an_object>(n->type);
52105214
// object initialized by the address of the curr() object
5211-
if (peek(1) && peek(1)->type() == lexeme::Ampersand) {
5215+
if (peek(1)->type() == lexeme::Ampersand) {
52125216
type->address_of = &curr();
52135217
}
52145218
// object initialized by (potentially multiple) dereference of the curr() object
5215-
else if (peek(1) && peek(1)->type() == lexeme::Multiply) {
5219+
else if (peek(1)->type() == lexeme::Multiply) {
52165220
type->dereference_of = &curr();
52175221
for (int i = 1; peek(i)->type() == lexeme::Multiply; ++i)
52185222
type->dereference_cnt += 1;
52195223
}
52205224
else if (
52215225
// object initialized by the result of the function call (and it is not unnamed function)
5222-
(peek(1) && peek(1)->type() == lexeme::LeftParen && curr().type() != lexeme::Colon)
5226+
(peek(1)->type() == lexeme::LeftParen && curr().type() != lexeme::Colon)
52235227
|| curr().type() == lexeme::Identifier // or by the object (variable that the type need to be checked)
52245228
) {
52255229
type->suspicious_initialization = &curr();

0 commit comments

Comments
 (0)