-
Notifications
You must be signed in to change notification settings - Fork 69
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
Fix error reported by Clang #1702
Conversation
Error message: ./numerics/fixed_arrays_body.hpp:122:46: error: use 'template' keyword to treat 'Row' as a dependent template name typename FixedMatrix<Scalar, rows, columns>::Row<r> ^ template
Can one of the admins verify this patch? |
retest this please |
@aw1621107, it seems that this confuses MSVC: Maybe it is one of these cases where we need a TEMPLATE macro that expands to template for clang only? We used to have a TYPENAME like this... |
An alternative would be to use a trailing return type |
Here is the commit that removed |
Should I close this PR then? |
No, add |
Another alternative is to change the declaration to |
I interpret the last section of this article on cppreference as saying that (1) |
The standard requires `template` for dependent template names used in definitions and permits it in definitions. Using `template` in the definition but not the declaration seems to confuse MSVC, though: numerics/fixed_arrays_body.hpp(125): error C2244: 'principia::numerics::internal_fixed_arrays::FixedMatrix<Scalar,rows,columns>::row': unable to match function definition to an existing declaration.
Alright, I think I implemented @eggrobin's change? |
numerics/fixed_arrays.hpp
Outdated
@@ -72,7 +72,7 @@ class FixedMatrix final { | |||
}; | |||
|
|||
template<int r> | |||
Row<r> row() const; | |||
typename FixedMatrix<Scalar, rows, columns>::template Row<r> row() const; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the parameters on FixedMatrix
: within the definition, FixedMatrix
without parameters refers to the class being defined. The following should be enough:
template<int r>
typename FixedMatrix::template Row<r> row() const;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, didn't know that. Fixed!
As usual, thanks for the contribution. |
Error message: