Skip to content
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

std::is_same_v<> produces wrong insight #328

Closed
tocic opened this issue Jul 10, 2020 · 1 comment
Closed

std::is_same_v<> produces wrong insight #328

tocic opened this issue Jul 10, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@tocic
Copy link

tocic commented Jul 10, 2020

The following code produces wrong insight:

#include <iostream>
#include <type_traits>

int main() {
    std::cout << std::is_same_v<void(int), void(const int)> << '\n';
    std::cout << std::is_same_v<void(int*), void(const int*)> << '\n';
}

||
v

#include <iostream>
#include <type_traits>

int main()
{
  std::operator<<(std::cout.operator<<(std::is_same_v), '\n');
  std::operator<<(std::cout.operator<<(std::is_same_v), '\n');
}

While this example is okay:

#include <iostream>
#include <type_traits>

int main() {
    std::cout << std::is_same<void(int), void(const int)>::value << '\n';
    std::cout << std::is_same<void(int*), void(const int*)>::value << '\n';
}

||
v

#include <iostream>
#include <type_traits>

int main()
{
  std::operator<<(std::cout.operator<<(std::integral_constant<bool, true>::value), '\n');
  std::operator<<(std::cout.operator<<(std::integral_constant<bool, false>::value), '\n');
}

It's taken from the 254th C++ Quiz question, btw.

@andreasfertig andreasfertig added the bug Something isn't working label Jul 13, 2020
@andreasfertig
Copy link
Owner

Hello @tocic,

thanks for reporting this! That is an interesting one. On my Mac it works. However, the web site runs Linux so I have to dig a little deeper to figure out what goes wrong there. Anyway, as it is now it is a bug.

Andreas

andreasfertig added a commit that referenced this issue Jul 21, 2020
Fixed #328: Added missing template arguments of a variable template.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants