-
Notifications
You must be signed in to change notification settings - Fork 40
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
when the number of struct members is less than the number of columns in the table #74
Comments
This seems to be a bug, it works when you add a second member to |
Note that I consider it to be really bad practice to use |
I was thinking about this more and I think there are two separate questions here:
I think for question 2 the answer should be "No.", as this would usually mean that something is wrong or at least inefficient, and it is also inconsistent with how C++ is defined in other cases. Consider:
leads to a compiler error Likewise, the following code also fails:
with the error given by Clang: That said, both cases show that you want to have the correct amount of columns to prevent accidental mismatched columns. I still need to figure out how to fix the code for this (and question 1)... |
I fixed the single member aggregate case, but I still wonder if the code should check (obviously at runtime) for excess result columns as explained in my previous comment... |
I think my testcase was broken, as the code already contains a check for the correct number of columns, so from my perspective everything works as expected now. |
Found out what the problem with my original test was, I mixed up table names and never actually tested with data, hence the check in the code was never triggered. If there is data, the check was always there, so it would always catch the excess columns at runtime. The only bug was the compile-time problem for single member aggregates you found and that is fixed now. Case closed, thank you for the report! |
For example
Is it possible to convert to a struct with fewer members than the number of table columns?
The text was updated successfully, but these errors were encountered: