You need to use std::sin and std::cos in place of sin
and cos
so that you will obtain the properly overloaded versions. You can see the difference live:
MyClass variable = { 1.0f, 0.0f, 0.0f, 0.0f,
0.0f, std::cos(theta), -std::sin(theta), 0.0f,
0.0f, std::sin(theta), std::cos(theta), 0.0f,
0.0f, 0.0f, 0.0f, 1.0f };
It is unspecified behavior whether the functions from C libraries are first declared in the global namespace the C++ draft standard section 17.6.1.2
Headers paragraph 4 says(emphasis mine):
Except as noted in Clauses 18 through 30 and Annex D, the contents of each header cname shall be the same as that of the corresponding header name.h, as specified in the C standard library (1.2) or the C Unicode TR, as appropriate, as if by inclusion. In the C++ standard library, however, the declarations (except for names which are defined as macros in C) are within namespace scope (3.3.6) of the namespace std. It is unspecified whether these names are first declared within the global namespace scope and are then injected into namespace std by explicit using-declarations (7.3.3).
so in the case where the C library functions were in the global namespace you would be getting the version of cos and sin that only takes double which is consistent with the behavior we are seeing.