Skip to content

Commit c5ce444

Browse files
committed
Correctly recognize ::name as a qualified-id
1 parent 829d550 commit c5ce444

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

source/parse.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ struct type_id_node
555555
break;case empty:
556556
return {};
557557
break;case qualified:
558-
return get<qualified>(id)->get_token();
558+
return {};
559559
break;case unqualified:
560560
return get<unqualified>(id)->get_token();
561561
break;case keyword:
@@ -2337,10 +2337,10 @@ class parser
23372337
// Remember current position, because we need to look ahead to the next ::
23382338
auto start_pos = pos;
23392339

2340-
// If we don't get a first id, or if the next thing isn't :: or .,
2341-
// back out and report unsuccessful
2340+
// If we don't get a first id, or if we didn't have a leading :: and
2341+
// the next thing isn't :: or ., back out and report unsuccessful
23422342
term.id = unqualified_id();
2343-
if (!term.id || curr().type() != lexeme::Scope) {
2343+
if (!term.id || (!term.scope_op && curr().type() != lexeme::Scope)) {
23442344
pos = start_pos; // backtrack
23452345
return {};
23462346
}
@@ -2352,7 +2352,6 @@ class parser
23522352

23532353
n->ids.push_back( std::move(term) );
23542354

2355-
assert (curr().type() == lexeme::Scope);
23562355
while (curr().type() == lexeme::Scope)
23572356
{
23582357
auto term = qualified_id_node::term{ &curr() };

0 commit comments

Comments
 (0)