g++ -Wall -std=c++17 main.cpp -o main
main.cpp: In function 'constexpr void verify_foobar()':
main.cpp:15:39: error: no matching function for call to 'foobar_checker<foobar().std::basic_string_view<char, std::char_traits<char> >::length()>()'
foobar_checker<foobar().length()>();
^
main.cpp:11:16: note: candidate: template<long long unsigned int n> constexpr void foobar_checker()
constexpr void foobar_checker() {}
^~~~~~~~~~~~~~
main.cpp:11:16: note: template argument deduction/substitution failed:
In file included from c:\mingw\include\c++\7.1.0\bits\basic_string.h:48:0,
from c:\mingw\include\c++\7.1.0\string:52,
from c:\mingw\include\c++\7.1.0\bits\locale_classes.h:40,
from c:\mingw\include\c++\7.1.0\bits\ios_base.h:41,
from c:\mingw\include\c++\7.1.0\ios:42,
from c:\mingw\include\c++\7.1.0\ostream:38,
from c:\mingw\include\c++\7.1.0\iostream:39,
from main.cpp:1:
main.cpp:15:27: in constexpr expansion of 'foobar()'
main.cpp:15:36: in constexpr expansion of 'std::basic_string_view<char>(((const char*)"Hello world"))'
c:\mingw\include\c++\7.1.0\string_view:100:58: error: call to non-constexpr function 'static std::size_t std::char_traits<char>::length(const char_type*)'
: _M_len{__str == nullptr ? 0 : traits_type::length(__str)},
~~~~~~~~~~~~~~~~~~~^~~~~~~
main.cpp:15:39: note: in template argument for type 'long long unsigned int'
foobar_checker<foobar().length()>();
^