-
Notifications
You must be signed in to change notification settings - Fork 251
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
[BUG] Forward declaration of deduced namespace scope variable is ill-formed #315
Comments
Good catch, thanks. Namespace-scope variables have constraints (and I will likely be adding more, such as |
Would there be a way to opt-out of it? Like some |
What about this example? https://godbolt.org/z/n1azY7zbP:
Where is the line drawn? I think it's great being able to have some order independence. That's because I'm dubious. Even a full-fledged Cpp2 compiler would have to define what order independence means |
Quick ack re "interferes": Some examples of deduced return types can work more easily, such as when the body doesn't involve a function call that involves another deduced return type. Other examples (like yours above) are inherently order-dependent because the would require a dependency graph walk to resolve. Still other examples can be unresolvable (if there's a dependency cycle) and so the graph walk would have to flag and reject those cases, but I'm not sure that's a scalable approach especially when it can be affected by overload resolution and what overloads are visible. |
Hello everyone. Once again I want to congratulate Herb and the rest of the contributors for the amazing work. I truly believe that your work is of utmost importance for the future of c++. If C++ doesn’t make the leap with the new syntax soon, it will not be able to attract new developers, which will eventually push companies to use other languages (i.e. Rust) for which they will be able to find developers. Now that namespace scoped objects cannot be of a deduced type (i.e. lambdas), I find that I have to copy/paste multiple times in different functions the same lambda function (to use it in different vector of lambda variants), which leads do many lines of duplicate code. One solution would be to create those vectors of lambdas in main function and pass it to the other functions which would have to be templated. To avoid that I tried to make these lambdas concrete types, (i.e. Functors) but I haven’t found the way to make operator() work. I would like to ask if is a way to make operator() work currently either like a member function or UFCS, or like a free function such as in the case of the operator<< overload (since we don’t have friend yet), or is it planned for the future? A code example is available here I understand the complexities of solving the dependency graph, but in all honesty this limitation takes away a lot of convenience. Once again, thank you for cpp2, I’ve been trying it out converting some small projects in cpp2 and now it is really hard to go back and write cpp1 again.. I only miss clang-format and the highlighting. |
I can't even begin without it ;) |
Mixed mode and a macro works: https://godbolt.org/z/xoE8ra8jo.
|
Nice hack!!! Thank you :) |
Can you open a bug report for |
Thanks for pointing that out -- this was an oversight (I just didn't notice |
Describe the bug
To Reproduce
Steps to reproduce the behavior:
y := 0;
Expected result - what you expected to happen
To generate working code, if possible. Perhaps by replacing
auto
withdecltype(
initializing expression
)
.Actual result/error
The text was updated successfully, but these errors were encountered: