Naios / function2

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more
http://naios.github.io/function2
Boost Software License 1.0
545 stars 46 forks source link

Problems compiling a test program under MSVS 2017 #22

Closed ales-kunst closed 5 years ago

ales-kunst commented 5 years ago

@Naios

Hello Naios,

I have tried to use your header only library in my test project on MSVS 2017 version 15.3.5 and I get compiler errors. Let me explain the case: I have 3 header files (A.h, B.h, C.h) which look as follows: A.h

#pragma once

#include "function2\function2.hpp"

struct A {

   fu2::unique_function<bool(int, int)> eq_int_fn;

   A() {
      eq_int_fn = [](int a, int b) -> bool {return a == b; };
   }
};

B.h

#pragma once

#include "function2\function2.hpp"
#include <string>

struct B {

   fu2::function<bool(std::string, std::string)> eq_str_fn;

   B() {
      eq_str_fn = [](std::string a, std::string b) -> bool {return a == b; };
   }
};

C.h

#pragma once

#include "A.h"
#include "B.h"
#include "function2\function2.hpp"

struct C: public A, public B {

   fu2::function<bool(long, long)> eq_long_fn = [](long a, long b) -> bool {return a == b; };

};

and func2test.cpp.h

#include <iostream>
#include "C.h"
using namespace std;
int main(int argc, char* arc[])
{
   C c;
   cout << "Equal: " << c.eq_long_fn(10, 10) << endl;
   cout << "Equal: " << c.eq_int_fn(10, 11) << endl;
   cout << "Equal: " << c.eq_str_fn("A", "B") << endl;
   return 0;
}

Now if I set Project->Properties->C/C++->Language->C++ Language Standard setting to "ISO C++17 Standard (/std:c++17)" or "ISO C++ Latest Draft Standard (/std:c++latest)" the I get compilation errors (see below compiler log). In case if I set it to "ISO C++14 Standard (/std:c++14)" then everything works fine. Is this a bug or is this designed to work in such a way?

Compiler log:

1>------ Build started: Project: func2-test, Configuration: Debug x64 ------
1>func2test.cpp
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...)>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...)>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) const>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) const>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile const>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile const>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) const &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) const &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile const &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile const &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) const &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) const &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile const &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(522): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<Ret(Args...) volatile const &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...),Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...),Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...)>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...)>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) const,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) const,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) const>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) const>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile const,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile const,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile const>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile const>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) &,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) &,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) const &,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) const &,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) const &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) const &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile &,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile &,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile const &,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile const &,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile const &>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile const &>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) &&,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) &&,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) const &&,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) const &&,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) const &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) const &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile &&,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile &&,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile const &&,Next,Signatures...>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,Function,Ret(Args...) volatile const &&,Next,Signatures...>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): error C2953: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile const &&>': class template has already been defined
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(706): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<Index,fu2::abi_400::detail::function<Config,Property>,Ret(Args...) volatile const &&>'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1301): error C2504: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>,bool (int,int)>': base class undefined
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\a.h(7): note: see reference to class template instantiation 'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>' being compiled
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(535): error C2794: 'pointer_type': is not a member of any direct or indirect base class of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(739): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::invocation_table::invoke_table<bool (int,int)>' being compiled
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1014): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::tables::vtable<Property>' being compiled
1>        with
1>        [
1>            Property=fu2::abi_400::detail::property<true,false,bool (int,int)>
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1343): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::erasure<true,Config,fu2::abi_400::detail::property<true,false,bool (int,int)>>' being compiled
1>        with
1>        [
1>            Config=fu2::abi_400::detail::config<true,false,fu2::capacity_default>
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(535): error C2938: 'function_pointer_of<bool(int,int)>' : Failed to specialize alias template
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1472): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>,bool (int,int)>'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1297): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>,bool (int,int)>'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1472): error C2873: '()': symbol cannot be used in a using-declaration
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1242): error C2903: 'callable': symbol is neither a class template nor a function template
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\a.h(10): note: see reference to class template instantiation 'fu2::abi_400::detail::accepts_one<A::{ctor}::<lambda_480bcf0fb16eb88925f8ee9c4addaec8>,bool (int,int),fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>>' being compiled
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1242): error C2062: type 'unknown-type' unexpected
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1243): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1245): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1245): error C2065: 'value': undeclared identifier
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1246): error C2903: 'callable': symbol is neither a class template nor a function template
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1246): error C2062: type 'unknown-type' unexpected
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1247): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (int,int)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1247): error C2975: 'RequiresNoexcept': invalid template argument for 'fu2::abi_400::detail::invocation::is_noexcept_correct', expected compile-time constant expression
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(204): note: see declaration of 'RequiresNoexcept'
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\a.h(10): error C2679: binary '=': no operator found which takes a right-hand operand of type 'A::{ctor}::<lambda_480bcf0fb16eb88925f8ee9c4addaec8>' (or there is no acceptable conversion)
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1427): note: could be 'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>> &fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>::operator =(std::nullptr_t)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1394): note: or       'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>> &fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>::operator =(fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>> &&) noexcept(<expr>)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1393): note: or       'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>> &fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>::operator =(const fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>> &)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\a.h(10): note: while trying to match the argument list '(fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,false,Capacity>,fu2::abi_400::detail::property<true,false,bool (int,int)>>, A::{ctor}::<lambda_480bcf0fb16eb88925f8ee9c4addaec8>)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1301): error C2504: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>,bool (std::string,std::string)>': base class undefined
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\b.h(8): note: see reference to class template instantiation 'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>' being compiled
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(535): error C2794: 'pointer_type': is not a member of any direct or indirect base class of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (std::string,std::string)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(739): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::invocation_table::invoke_table<bool (std::string,std::string)>' being compiled
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1014): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::tables::vtable<Property>' being compiled
1>        with
1>        [
1>            Property=fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1343): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::erasure<true,Config,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>' being compiled
1>        with
1>        [
1>            Config=fu2::abi_400::detail::config<true,true,fu2::capacity_default>
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(535): error C2938: 'function_pointer_of<bool(std::string,std::string)>' : Failed to specialize alias template
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1472): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>,bool (std::string,std::string)>'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1297): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>,bool (std::string,std::string)>'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1243): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (std::string,std::string)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (std::string,std::string)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1245): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (std::string,std::string)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (std::string,std::string)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1247): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (std::string,std::string)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (std::string,std::string)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\b.h(11): error C2679: binary '=': no operator found which takes a right-hand operand of type 'B::{ctor}::<lambda_f3910cc3aea2b6888fed6879cd649046>' (or there is no acceptable conversion)
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1427): note: could be 'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>> &fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>::operator =(std::nullptr_t)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1394): note: or       'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>> &fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>::operator =(fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>> &&) noexcept(<expr>)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1393): note: or       'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>> &fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>::operator =(const fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>> &)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\b.h(11): note: while trying to match the argument list '(fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (std::string,std::string)>>, B::{ctor}::<lambda_f3910cc3aea2b6888fed6879cd649046>)'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1301): error C2504: 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (long,long)>>,bool (long,long)>': base class undefined
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\c.h(9): note: see reference to class template instantiation 'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (long,long)>>' being compiled
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(535): error C2794: 'pointer_type': is not a member of any direct or indirect base class of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (long,long)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(739): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::invocation_table::invoke_table<bool (long,long)>' being compiled
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1014): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::tables::vtable<Property>' being compiled
1>        with
1>        [
1>            Property=fu2::abi_400::detail::property<true,false,bool (long,long)>
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1343): note: see reference to class template instantiation 'fu2::abi_400::detail::type_erasure::erasure<true,Config,fu2::abi_400::detail::property<true,false,bool (long,long)>>' being compiled
1>        with
1>        [
1>            Config=fu2::abi_400::detail::config<true,true,fu2::capacity_default>
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(535): error C2938: 'function_pointer_of<bool(long,long)>' : Failed to specialize alias template
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1472): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (long,long)>>,bool (long,long)>'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1297): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::operator_impl<0,fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (long,long)>>,bool (long,long)>'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1243): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (long,long)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (long,long)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1245): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (long,long)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (long,long)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(1247): error C2027: use of undefined type 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (long,long)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\lib\function2\include\function2\function2.hpp(471): note: see declaration of 'fu2::abi_400::detail::type_erasure::invocation_table::function_trait<First>'
1>        with
1>        [
1>            First=bool (long,long)
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\c.h(9): error C2664: 'fu2::abi_400::detail::function<fu2::abi_400::detail::config<true,true,Capacity>,fu2::abi_400::detail::property<true,false,bool (long,long)>>::function(std::nullptr_t)': cannot convert argument 1 from 'C::<lambda_f6cd4ad39bd83322785042c7b76f3bda>' to 'std::nullptr_t'
1>        with
1>        [
1>            Capacity=fu2::capacity_default
1>        ]
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\c.h(9): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\func2test.cpp(9): error C2064: term does not evaluate to a function taking 2 arguments
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\func2test.cpp(10): error C2064: term does not evaluate to a function taking 2 arguments
1>d:\programming\cpp\3rdparty\tmp_project\func2-test\src\func2test.cpp(11): error C2064: term does not evaluate to a function taking 2 arguments
1>Done building project "func2-test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Commit Hash

On the latest commit (I think the commit hash is fd56e022e1b51a334ae865f2353736b49461718a). I downloaded zip on 28.01.2019. Sorry for my bad knowledge about this stuff. I am very new to this stuff.

Expected Behavior

I think the compiling should go through also with the settings for C++17 on MSVS 2017.

Actual Behavior

Compiler error if Language Standard is set to c++17 or latest.

Steps to Reproduce

Written above in the description of my problem.

Your Environment

Installed Version: Professional

Visual Basic 2017 00370-20004-20195-AA847 Microsoft Visual Basic 2017

Visual C# 2017 00370-20004-20195-AA847 Microsoft Visual C# 2017

Visual C++ 2017 00370-20004-20195-AA847 Microsoft Visual C++ 2017

JavaScript Language Service 2.0 JavaScript Language Service

MenuCommands Extension 1.0 MenuCommands Visual Studio Extension Detailed Info

Microsoft JVM Debugger 1.0 Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger 1.0 Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0 Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package 1.0 Microsoft Visual Studio VC Package

Visual C++ for Linux Development 1.0.7 Visual C++ for Linux Development

Visual Studio Code Debug Adapter Host Package 1.0 Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Naios commented 5 years ago

The library works with MSVC /std:c++latest, /std:c++17 and /std:c++14 set (just tested it). Naios/continuable@d72e1bfb86d1e53a which depends on function2 also builds with MSVC /std:c++latest as the CI indicates.

ales-kunst commented 5 years ago

Yep, you are right. I have tried it on another machine which has MSVS 2017 version 15.9.4 and it works. It must be some MSVC problem :(. Thanks for the answer and sorry for any inconvenience.