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

Error in MSVC2010 when using named arguments #188

Closed
vitaut opened this issue Jul 8, 2015 · 1 comment
Closed

Error in MSVC2010 when using named arguments #188

vitaut opened this issue Jul 8, 2015 · 1 comment

Comments

@vitaut
Copy link
Contributor

vitaut commented Jul 8, 2015

C:\cppformat\format.h(864): error C2664: 'fmt::internal::check' : cannot convert parameter 1 from 'const fmt::internal::NamedArg<Char>' to 'bool'
          with
          [
              Char=char
          ]
          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
          C:\cppformat\format.h(2968) : see reference to class template instantiation 'fmt::internal::IsConvertibleToInt<T>' being compiled
          with
          [
              T=fmt::internal::NamedArg<char>
          ]
          format-test.cc(636) : see reference to function template instantiation 'std::string fmt::format<fmt::internal::NamedArg<Char>,fmt::internal::NamedArg<Char>,fmt::internal::NamedArg<Char>>(fmt::CStringRef,const T0 &,const T1 &,const T2 &)' being compiled
          with
          [
              Char=char,
              T0=fmt::internal::NamedArg<char>,
              T1=fmt::internal::NamedArg<char>,
              T2=fmt::internal::NamedArg<char>
          ]
C:\cppformat\format.h(864): error C2056: illegal expression
vitaut added a commit that referenced this issue Jul 10, 2015
Due to broken lookup rules, MSVC finds fmt::internal::check
instead of IsConvertibleToInt::check.
@vitaut
Copy link
Contributor Author

vitaut commented Jul 10, 2015

MSVC is a fucking mess:

namespace a {

int f(bool) { return 0; }

struct A {};

template <typename T>
struct B {
  static int f(int) { return 0; }
  static int f(...) { return 0; }

  enum {E = sizeof(f(T()))}; // error C2664: 'a::f' : cannot convert parameter 1 from 'a::A' to 'bool'
};
}

void h() {
    a::B<a::A>::E;
}

@vitaut vitaut closed this as completed Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant