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

Unable to compile with MSVC 19.11 (VS15.3 or VS2017.3) #181

Closed
egorpugin opened this issue Aug 15, 2017 · 17 comments
Closed

Unable to compile with MSVC 19.11 (VS15.3 or VS2017.3) #181

egorpugin opened this issue Aug 15, 2017 · 17 comments

Comments

@egorpugin
Copy link
Contributor

Hi!

MS released VS 15.3 (2017.3) with first toolset update and build is broken in /std:c++17 mode.
Errors:

\include\sqlpp11/statement.h(156): error C2903: '_base_t': symbol is neither a class template nor a function template
\include\sqlpp11/insert.h(109): note: see reference to class template instantiation 'sqlpp::statement_t<void,sqlpp::insert_t,sqlpp::no_into_t,sqlpp::no_insert_value_list_t>' being compiled
\date.h(111): note: see reference to class template instantiation 'std::chrono::duration<int,std::ratio<86400,1>>' being compiled
\include\sqlpp11/statement.h(166): error C3546: '...': there are no parameter packs available to expand
\include\sqlpp11/statement.h(173): error C3546: '...': there are no parameter packs available to expand
\include\sqlpp11/statement.h(179): error C3546: '...': there are no parameter packs available to expand
\include\sqlpp11/table.h(48): error C2903: '_member_t': symbol is neither a class template nor a function template
\include\sqlpp11/verbatim_table.h(53): note: see reference to class template instantiation 'sqlpp::table_t<sqlpp::verbatim_table_t,sqlpp::detail::unusable_pseudo_column_t>' being compiled

sqlite3 connector 0.24 + sqlpp11 develop.

@rbock
Copy link
Owner

rbock commented Aug 16, 2017

Hi Egor,

Are those all error messages? No static assert or anything? Can you send a minimal example that produces this or a similar error?

Thanks,

Roland

@egorpugin
Copy link
Contributor Author

Sure. :) And yes, no other static asserts or something.

#include <sqlpp11/sqlpp11.h>

int main()
{
    return 0;
}

@rbock
Copy link
Owner

rbock commented Aug 16, 2017

Oh, wow!

That's scary... Does it also happen if you turn off the explicit C++17 mode?

Also, can you try including sqlpp11/verbatim_table.h, only?

@egorpugin
Copy link
Contributor Author

egorpugin commented Aug 16, 2017

Oops. I've tried other modes (c++14, c++latest and no explicit) and they're broken too (with my example above).

With single sqlpp11/verbatim_table.h include:

\sqlpp11/verbatim_table.h(42): error C2039: 'make_char_sequence': is not a member of 'sqlpp'
\sqlpp11/verbatim_table.h(33): note: see declaration of 'sqlpp'
\sqlpp11/verbatim_table.h(42): error C2061: syntax error: identifier 'make_char_sequence'
\sqlpp11/verbatim_table.h(42): error C2238: unexpected token(s) preceding ';'
\sqlpp11/table.h(48): error C2903: '_member_t': symbol is neither a class template nor a function template
\sqlpp11/verbatim_table.h(53): note: see reference to class template instantiation 'sqlpp::table_t<sqlpp::verbatim_table_t,sqlpp::detail::unusable_pseudo_column_t>' being compiled
\sqlpp11/verbatim_table.h(59): error C2039: 'make_char_sequence': is not a member of 'sqlpp'
\sqlpp11/verbatim_table.h(33): note: see declaration of 'sqlpp'
\sqlpp11/verbatim_table.h(59): error C2061: syntax error: identifier 'make_char_sequence'
\sqlpp11/verbatim_table.h(59): error C2238: unexpected token(s) preceding ';'

@rbock
Copy link
Owner

rbock commented Aug 16, 2017

Oh, ok, that is an actual error (missing include). Fixed it on develop.

Can you pull and try again?

Thanks!

@egorpugin
Copy link
Contributor Author

With single verbatim_table.h:

\include\sqlpp11/table.h(48): error C2903: '_member_t': symbol is neither a class template nor a function template
\include\sqlpp11/verbatim_table.h(54): note: see reference to class template instantiation 'sqlpp::table_t<sqlpp::verbatim_table_t,sqlpp::detail::unusable_pseudo_column_t>' being compiled

@rbock
Copy link
Owner

rbock commented Aug 16, 2017

Thanks! I am quite confident now that this is a compiler bug.
If you look at table.h and verbatim_table.h, you'll quickly spot the relevant parts:

  namespace detail
  {
    struct unusable_pseudo_column_t
    {
      struct _alias_t
      {
        template <typename T>
        struct _member_t // <---- This is the member template that the compiler cannot find
        {
        };
      };
      using _traits = make_traits<no_value_t>;
    };
  }

Above you see the _member_t template that the compiler cannot find here

  template <typename Table, typename... ColumnSpec>
  struct table_t : public table_base_t, public ColumnSpec::_alias_t::template _member_t<column_t<Table, ColumnSpec>>...

when specialized like this:

  struct verbatim_table_t : public table_t<verbatim_table_t, detail::unusable_pseudo_column_t>
  {
   //...
  };

I still need Microsoft's team to use sqlpp11 as a unit test :-(

It might be possible to create some alias template that wraps the ColumnSpec::_alias_t::template _member_t part. But there is a good chance that such a workaround will break older versions of MSVC.

So I do not have a good solution for this other than reporting a bug at Microsoft. Would you like to do that?

@rbock
Copy link
Owner

rbock commented Aug 16, 2017

Does this compile on your machine?

template <typename Table, typename ColumnSpec>
struct column_t
{
};

struct table_base_t
{
};

template <typename Table, typename... ColumnSpec>
struct table_t : public table_base_t, public ColumnSpec::_alias_t::template _member_t<column_t<Table, ColumnSpec>>...
{
};

namespace detail
{
  struct unusable_pseudo_column_t
  {
    struct _alias_t
    {
      template <typename T>
      struct _member_t
      {
      };
    };
  };
}

struct verbatim_table_t : public table_t<verbatim_table_t, detail::unusable_pseudo_column_t>
{
};

int main()
{
}

That's basically the code that produced the error message (except that the struct bodies are more complex in the real code);

@egorpugin
Copy link
Contributor Author

egorpugin commented Aug 16, 2017

I'll file an issue there. I already prepared minimal not working example.

struct U { template <class T> struct b {}; };
template <typename ... Args>
struct T : Args::template b<int>... {};
struct V : public T<U> {};

@egorpugin
Copy link
Contributor Author

@rbock
Copy link
Owner

rbock commented Aug 16, 2017

Awesome!

@egorpugin
Copy link
Contributor Author

@egorpugin
Copy link
Contributor Author

According to https://connect.microsoft.com/VisualStudio/feedback/details/3139514

This issue has been fixed and will be available in the next major release of VS2017.

As I understand it will be in VS15.5.

@rbock
Copy link
Owner

rbock commented Oct 10, 2017

That's good news indeed! Thanks again for reporting it.

I also talked to members of Microsoft's compiler team at CppCon. They are looking into adding sqlpp11 to their test suite. This would help a lot.

@rbock
Copy link
Owner

rbock commented Oct 15, 2017

Hi,

I just learned that Microsoft regularly tests their compiler against all packages in https://github.com/Microsoft/vcpkg

As am not a Windows/MSVC user, it would be awesome if somebody could take the job of adding sqlpp11.

Best,

Roland

@rbock
Copy link
Owner

rbock commented Dec 2, 2017

As @juandent commented here rbock/sqlpp11-connector-sqlite3#36 (comment) , VS 15.5.0 Preview 5 seems to fix the problem. Keep your fingers crossed that the actual release will do so, too :-)

@rbock
Copy link
Owner

rbock commented Jun 1, 2018

With current versions, it should be fine. Please open a new issue otherwise.

@rbock rbock closed this as completed Jun 1, 2018
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

2 participants