Skip to content

Instantly share code, notes, and snippets.

@fujii
Created September 30, 2021 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujii/0d5d95df5f27bb5b61ac73b946297491 to your computer and use it in GitHub Desktop.
Save fujii/0d5d95df5f27bb5b61ac73b946297491 to your computer and use it in GitHub Desktop.
wrong overload resolution with a const enum of which value is zero
// https://bugs.webkit.org/show_bug.cgi?id=229223#c88
// https://developercommunity.visualstudio.com/t/wrong-overload-resolution-with-a-const-e/1542855?entry=myfeedback&space=62&q=overload+enum+const&stateGroup=active
#include <iostream>
enum X86Registers {
eax,
ebx,
};
struct ImplicitAddress {
ImplicitAddress(X86Registers) { }
};
void loadPtr(ImplicitAddress)
{
std::cout << "GCC or Clang" << std::endl;
}
void loadPtr(void*)
{
std::cout << "MSVC" << std::endl;
}
int main()
{
const X86Registers regT0 = eax;
loadPtr(regT0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment