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

Expansion statements do not handle immediate invocations correctly #296

Open
DarkArc opened this issue Mar 18, 2021 · 1 comment
Open

Expansion statements do not handle immediate invocations correctly #296

DarkArc opened this issue Mar 18, 2021 · 1 comment
Labels
bug Something isn't working reflection

Comments

@DarkArc
Copy link
Contributor

DarkArc commented Mar 18, 2021

The following should be valid:

enum E
{
    e1, e2
};

int main()
{
    constexpr auto m = meta::members_of( ^E );
    template for (constexpr auto x: m) { 
        char const * name = meta::name_of( x );
    }
}

However, we do not setup an immediate invocation correctly for the meta::name_of call. This results in an incorrect diagnostic.

@DarkArc DarkArc added bug Something isn't working reflection labels Mar 18, 2021
@davrec72
Copy link

Just glancing at this vs. your old implem on gitlab, perhaps this change is responsible:
Old: https://gitlab.com/lock3/clang/-/blob/feature/reflect/clang/lib/Sema/SemaExpr.cpp#L16233
New: https://github.com/lock3/meta/blob/feature/reflect/clang/lib/Sema/SemaExpr.cpp#L16313
Note too that if you change the example to meta::name_of( ^E ) it does indeed wrap it in a ConstantExpr, judging from the dump on cppx.godbolt, so the x is the problem; presumably something to do with its dependence.
No real clue, but hope that helps, good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working reflection
Projects
None yet
Development

No branches or pull requests

2 participants