std::variant "compiler error" when using CMake cross-platform compilation

The following code compiles fine, both with the VS C++ compiler as well as GCC on a remote Linux machine:

#include <variant>
int main()
{
    std::variant<const char*, bool> a = "ABC";
    return 0;
}

However, when using cross-platform remote compilation, Resharper generates a compiler error in the Code Issues and puts red squiggles in the editor:

     ResharperVariant.cpp:5 No viable constructor. Candidates considered:
 variant<typename _Tp>(_Tp&& __t) noexcept(…)
   substitution failed with _Tp = const char(&)[4]
Other constructors are explicit:
 variant<typename _Tp, typename ... _Args>(std::in_place_type_t<_Tp>, _Args&&...)
 variant<typename _Tp, typename _Up, typename ... _Args>(std::in_place_type_t<_Tp>, std::initializer_list<_Up> __il, _Args&&...)
 variant<long unsigned int _Np, typename ... _Args, _Tp = std::variant<const char*, bool>::__to_type<_Np, typename std::enable_if<(_Np < 2)>::type>>(std::in_place_index_t<_Np>, _Args&&...)
 variant<long unsigned int _Np, typename _Up, typename ... _Args, _Tp = std::variant<const char*, bool>::__to_type<_Np, typename std::enable_if<(_Np < 2)>::type>>(std::in_place_index_t<_Np>, std::initializer_list<_Up> __il, _Args&&...)
   
I have uploaded a minimal CMake project as Upload id: 2026_05_18_3QgbMXcepnZ13jKbv1aGU8 (file: ResharperVariant.7z)
 

0
4 comments

Thank you for reporting the issue. That is weird. I wasn't able to reproduce on my end with ReSharper 2026.1.1 in VS 2026 ans WSL:Ubuntu. What OS is the remote linux?
Would you mind sharing a screenshot that demonstrates the issue?

0

I can reproduce, thanks for the sample project!

R# thinks that this toolchain doesn't support `__is_same`, which leads to constexpr evaluation errors. I've filed https://youtrack.jetbrains.com/issue/RSCPP-37519/, this will be fixed in one of the 2026.2 EAP builds.

0

Thank you for the quick analysis.

FTR, the Linux build OS I tested was Debian 13 6.12.85+deb13-amd64 with gcc 14.2.0-19

0
Thank you for the clarification. The fix will be in the upcoming 2026.2 EAP 3 release.
0

Please sign in to leave a comment.