Skip to content

[BUG] using the using keyword inside a namespace with global functions results in code that does not compile #1213

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

Open
farmerpiki opened this issue Aug 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@farmerpiki
Copy link
Contributor

quick example for reproducing:

xf: () -> int = 42;
qq: namespace = {
using ::xf;
}

results in:

namespace qq {
using ::xf;
}

being declared before [[nodiscard]] auto xf() -> int;
which makes the code not compile due to cpp1 requiring ordering.

@farmerpiki farmerpiki added the bug Something isn't working label Aug 7, 2024
@JohelEGP
Copy link
Contributor

JohelEGP commented Oct 4, 2024

See also #470 and #641 (comment).

@farmerpiki
Copy link
Contributor Author

Of a Cpp2 function, its Cpp1 declaration.
Of a Cpp2 non-expression alias, its Cpp1 declaration.
Of a Cpp2 expression alias, its Cpp1 definition.

  • according to this order it should work, maybe namespaces change the order, I didn't notice them mentioned in the list anywhere, because i'm aliasing the cpp2 function which should be forward declared before

@JohelEGP
Copy link
Contributor

JohelEGP commented Oct 4, 2024

Yeah, it doesn't mention namespaces.
I suppose they're implicit, since they're required anyways.
The comment is from months before using declarations (commit dd04703).

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