使用“if constexpr”时的ICE [英] ICE when using "if constexpr"

查看:87
本文介绍了使用“if constexpr”时的ICE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MSVC 15.7.4下构建以下程序时看到内部编译器错误

I'm seeing internal compiler error when building the following program under MSVC 15.7.4

struct Baz; struct set { template <typename T> constexpr static bool contains = true; }; class Doer { public: template <typename S> constexpr explicit Doer(S) { if constexpr (S::template contains<Baz>) { ; } else { ; } } }; int main() { constexpr static set s{}; constexpr static Doer doer(s); }


 

此代码在其他现代编译器下成功编译("未使用的doer变量"警告旁边)。我认为代码是有效的,我认为MSVC现在完全支持C ++ 17常量表达式变量?

 

This code compiles successfully under other modern compilers ("unused doer variable" warning aside). I think the code is valid, and I thought that MSVC now fully supports C++17 constant expression variables?

这是完整的命令行:

>------ Build started: Project: CMakeLists, Configuration: RelWithDebInfo ------
Build started 19/06/2018 19:13:13.
RunExternalTool:
  [1/2] C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1414~1.264\bin\HostX64\x64\cl.exe  /nologo /TP   /DWIN32 /D_WINDOWS /W3 /GR /EHsc /permissive- /MD /Zi /O2 /Ob1 /DNDEBUG   -std:c++17 /showIncludes /FoCMakeFiles\test13.dir\main.cpp.obj /FdCMakeFiles\test13.dir\ /FS -c U:\Sources\test13\main.cpp
  FAILED: CMakeFiles/test13.dir/main.cpp.obj 
  C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1414~1.264\bin\HostX64\x64\cl.exe  /nologo /TP   /DWIN32 /D_WINDOWS /W3 /GR /EHsc /permissive- /MD /Zi /O2 /Ob1 /DNDEBUG   -std:c++17 /showIncludes /FoCMakeFiles\test13.dir\main.cpp.obj /FdCMakeFiles\test13.dir\ /FS -c U:\Sources\test13\main.cpp
U:\Sources\test13\main.cpp(11): fatal error C1001: An internal error has occurred in the compiler.
  (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\p0gettok.c', line 7562)
   To work around this problem, try simplifying or changing the program near the locations listed above.
  Please choose the Technical Support command on the Visual C++ 
   Help menu, or open the Technical Support help file for more information
  ninja: build stopped: subcommand failed.




$




推荐答案

>我看到了在MSVC 15.7.4下构建以下程序时出现内部编译器错误

>I'm seeing internal compiler error when building the following program under MSVC 15.7.4

最新预览(15.8预览版2)编译器存在同样的问题。

The latest preview (15.8 preview 2) compiler has the same issue.

请使用VS中的报告问题工具向MS报告并在此处发布您的错误报告的链接,我将对此进行确认。

Please report it to MS using the Report a Problem facility in VS and post a link to your bug report back here and I'll confirm it.

这可能是MS所知道的,但它是最好确保它们是。

It's probably something MS are aware of, but it's best to make sure they are.

戴夫


这篇关于使用“if constexpr”时的ICE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆