Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nonexistent variable used, with unbalanced parentheses #20

Closed
tavianator opened this issue May 28, 2018 · 0 comments
Closed

Nonexistent variable used, with unbalanced parentheses #20

tavianator opened this issue May 28, 2018 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@tavianator
Copy link

This example on cppinsights.io:

#include <map>

int main()
{
    std::map<int, int> map{{1, 2}};
    auto [key, value] = *map.begin();
}

apparently desugars to

#include <map>

int main()
{
    std::map<int, int> map{ std::initializer_list<std::pair<const int, int> >{ std::pair<const int, int>(1, 2) } };
    std::pair<const int, int> __operator6 = std::pair<const int, int>(map.begin().operator*());
    std::tuple_element<0, std::pair<const int, int> >::type&& key = std::get<0ul>(__operator6);
    std::tuple_element<1, std::pair<const int, int> >::type&& value = std::get<1ul>(__opemap.begin().operator*() 
}

But __opemap.begin().operator*() should presumably be __operator6)

@andreasfertig andreasfertig added the bug Something isn't working label May 28, 2018
@andreasfertig andreasfertig self-assigned this May 28, 2018
andreasfertig pushed a commit that referenced this issue May 28, 2018
In case of a decomposition decl which decomposed a class with a
CXXOperatorCallExpr two matchers hit and as a result the reslting code
was incorrect. In such a case the CXXOperator matcher should not match,
as the case is handled by the StructuredBindingsHandler.
andreasfertig pushed a commit that referenced this issue May 28, 2018
In case of a decomposition decl which decomposed a class with a
CXXOperatorCallExpr two matchers hit and as a result the reslting code
was incorrect. In such a case the CXXOperator matcher should not match,
as the case is handled by the StructuredBindingsHandler.
andreasfertig pushed a commit that referenced this issue May 28, 2018
Fixed #20: DecompositionDecl with CXXOperatorCallExpr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants