cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

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

Open farmerpiki opened this issue 1 year ago • 3 comments

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 avatar Aug 07 '24 06:08 farmerpiki

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

farmerpiki avatar Oct 04 '24 07:10 farmerpiki

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 dd047033de5a691721069eb9ddb5b4f7892afa94).

JohelEGP avatar Oct 04 '24 07:10 JohelEGP