-
Notifications
You must be signed in to change notification settings - Fork 260
[BUG] std::array usage #564
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
Comments
You're missing the initializer, see https://cpp2.godbolt.org/z/48vhscfKj or https://cpp2.godbolt.org/z/WbGdec3bz: - arr: std::array<std::string, 5>;
+ arr: std::array<std::string, 5> = (); arr: std::array<std::string, 5>;
+ arr = (); |
You should've gotten an error like https://cpp2.godbolt.org/z/YraaP1oTK:
So there's definitely a bug in Cppfront. |
Ok, yes, I just discovered that when I tried to call a cpp1 function to add the string. Then it did tell me that I was trying to use the array before initializing it. |
One other thing that I've noticed (although this may be unrelated to the bug described above), is that if #define CPP2_USE_MODULES Yes and as a result, g++ then fails with the message that |
Yeah. |
Thanks. Good points... I'm working on a commit to give a better diagnostic for the lack of first use, and to always emit a deferred constructions as list initialization (which I'd already been moving towards in recent commits... sorry, So this example:
will get the nicer error And this fixed example:
will now work. |
…sutter#564 Also fixed a build break that slipped in a couple of hours ago for GCC and Clang (from inadvertently using an incomplete type, which MSVC didn't diagnose and I hadn't re-run the GCC and Clang builds)
Describe the bug
cppfront -p allows both
operator[]
andat()
on a std::array, but these result in errors in g++.To Reproduce
Steps to reproduce the behavior:
cppfront compiler v0.2.1 Build 8724:0846
g++ (Debian 12.2.0-14) 12.2.0
Although it's unclear whether std::array is properly supported, I was hoping that at least the
.at()
syntax would be accepted (and cppfront did accept both, as shown above) and subsequently compiled by g++.The compilation step results in the following:
If the
arr[0]
line is commented out, g++ outputs the following:Additional context
I have been alpha-testing cppfront with some "beginners" C++-11 programs. It would be very helpful if there was a simple list of keywords/features with an indication of support status.
The text was updated successfully, but these errors were encountered: