woboq / verdigris

Qt without moc: set of macros to use Qt without needing moc
https://woboq.com/blog/verdigris-qt-without-moc.html
GNU Lesser General Public License v3.0
643 stars 60 forks source link

Latest MSVC release (15.8) breaks inheritance #44

Closed jcelerier closed 6 years ago

jcelerier commented 6 years ago

The following code does not compile anymore (in c++14 or 17 mode)

class baz { };

class foo : public QObject, public baz
{
  W_OBJECT(foo)

  void blah() W_SIGNAL(blah)
  void bol(const foo* arg) W_SIGNAL(bol, arg)
  void slot_push(const foo*); W_SLOT(slot_push);
};

W_REGISTER_ARGTYPE(const foo*)
W_OBJECT_IMPL(foo)

It fails with errors such as :

wobjectimpl.h:199: error: C2440: 'initializing': cannot convert from 'void (__cdecl *)(void)' to 'F' 
with [ F=void (__cdecl foo::* )(void) ]

edit: simplfied a bit the repro :

class baz { };

class foo : public QObject, public baz
{
  W_OBJECT(foo)

  void blah() W_SIGNAL(blah)
  void x()
  {
    using namespace w_internal;
    constexpr auto x = w_internal::makeMetaSignalInfo(
        &foo::blah, 
        StaticStringArray<5>{"blah"}, 
        w_internal::simple_hash("blah"), 
        StaticStringList<>{}, 
        StaticStringList<>{});
  }
};
jcelerier commented 6 years ago

simplified it to something that can't be anything else than a compiler bug :

template<typename F>
struct Functor {
  F func;
};

template<typename F>
constexpr Functor<F> fun(F f)
{
  return {f};
}

class bar { };
class baz { };

class foo: public bar, public baz
{
  void blah() { }
  void x()
  {
    constexpr auto x = fun(&foo::blah);
  }
};

I reported it : https://developercommunity.visualstudio.com/content/problem/311491/simple-code-does-not-compile-anymore-in-vs2017-158.html

ogoffart commented 6 years ago

Since apparently they are going to fix the issue in a patch release, I guess I can close this issue.

jcelerier commented 6 years ago

yep !