taocpp / PEGTL

Parsing Expression Grammar Template Library
Boost Software License 1.0
1.94k stars 229 forks source link

MSVC: error C2607: static assertion failed #296

Closed matbech closed 2 years ago

matbech commented 2 years ago

With _MSC_VER 1931 (Version 17.1.0 Preview 3.0) I get this compilation error:

json\external\PEGTL\include\tao\pegtl\demangle.hpp(119,28): error C2607: static assertion failed

      static_assert( begin != std::string_view::npos );

Compile flags: /JMC /Yu"stdafx.h" /MP /ifcOutput "x64\Debug\" /GS /W3 /Zc:wchar_t /guard:cf /Zi /Gm- /Od /sdl /Fd"C:\Projects\SmartFTP\x64\Debug\Google.pdb" /guard:ehcont /Zc:inline /fp:precise /D "WIN32" /D "_DEBUG" /D "_LIB" /D "_CRT_SECURE_NO_WARNINGS" /D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /MDd /std:c++latest /FC /Fa"x64\Debug\" /EHsc /nologo /Fo"x64\Debug\" /Fp"x64\Debug\Google.pch" /diagnostics:column

#pragma message( __FUNCSIG__ ) prints class std::basic_string_view<char,struct std::char_traits<char> > __cdecl tao::pegtl::demangle(void) noexcept Note the missing template parameter <T>

Surprisingly Intellisense displays (in a tooltip) the function signature with the template parameter

Maybe std::source_location should be used on c++20? I tried this:

std::source_location::current().function_name();

but function_name() returns an empty string.

d-frey commented 2 years ago

Since #pragma might work at a different level of the compilation process: Could you dig deeper and see what an actual instantiation of the method would produce? If it still swallows the <T> part, I would consider this a bug in MSVC.

ColinH commented 2 years ago

Version 3.2.3 contains a fix.