You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 8, 2020. It is now read-only.
It's the CDT's issue. It cannot handle ambiguities for ellipsis (...)in parameter declaration.
For instance following function (LocOffsetEnd: 19, LocOffsetStart: 0):
voidfoo(int&...);
takes various number of int references. In CDT ... notation is called ellipsis. A parser parses all tokens correctly but at the end it visits CPPASTAmbiguityResolver, which tries to resolve ambiguity, what calls CPPASTAmbiguousParameterDeclaration.doResolveAmbiguity.
This class is responsible for:
Handles ambiguities for ellipsis in parameter declaration.
template<typename... T> void function(T ...); // is T a parameter pack?
and it tries to adjustOffsets(dtor).
Unfortunately the function does not work well if we have any parameters next to the type (&, *).
Here is a snippet from adjustOffsets function:
We have only one param &, so the first and last point to the same node with offset 12 and length 1.
In my opinion the function setOffsetAndLength (which overwrites position) is called incorrectly, because the second parameter value (last.getOffset() + last.getLength()) points to the end offset, but the function signature is:
voidsetOffsetAndLength(intoffset, intlength)
so, now if we try to calculate the end offset it will be offset + length.
In our case original offset was 12, length 1, but after adjust the length was 12 + 1 = 13, so the end offset is 25, what in our case it goes out of bounds [0, 19]
Activity
kuba-- commentedon Aug 20, 2019
It's the CDT's issue. It cannot handle ambiguities for ellipsis (
...)in parameter declaration.For instance following function (LocOffsetEnd: 19, LocOffsetStart: 0):
takes various number of
intreferences. In CDT...notation is called ellipsis. A parser parses all tokens correctly but at the end it visitsCPPASTAmbiguityResolver, which tries to resolve ambiguity, what callsCPPASTAmbiguousParameterDeclaration.doResolveAmbiguity.This class is responsible for:
and it tries to
adjustOffsets(dtor).Unfortunately the function does not work well if we have any parameters next to the type (
&,*).Here is a snippet from
adjustOffsetsfunction:We have only one param
&, so thefirstandlastpoint to the same node with offset12and length1.In my opinion the function
setOffsetAndLength(which overwrites position) is called incorrectly, because the second parameter value (last.getOffset() + last.getLength()) points to the end offset, but the function signature is:so, now if we try to calculate the end offset it will be
offset + length.In our case original offset was 12, length 1, but after adjust the length was
12 + 1 = 13, so the end offset is25, what in our case it goes out of bounds [0, 19]kuba-- commentedon Aug 21, 2019
https://bugs.eclipse.org/bugs/show_bug.cgi?id=550310