属性' fallthrough'不能在这种情况下应用

时间:2017-09-26 12:17:40

标签: c++ attributes visual-studio-2017 c++17

我试图在visual studio 2017中使用c ++ 17 MediaSource mainSource = new ExtractorMediaSource(firstVideoUri, ...); MediaSource secondSource = new ExtractorMediaSource(secondVideoUri, ...); MediaSource thirdSource = new ExtractorMediaSource(thirdVideoUri, ...); // Plays the first video, then second & third video. ConcatenatingMediaSource concatenatedSource = new ConcatenatingMediaSource(mainSource, secondSource, thirdSource); 属性:

[[fallthrough]]

但是我收到编译错误:

  

属性' fallthrough'不能在这种情况下应用

这似乎是你可以使用Qt::ItemFlags flags = Qt::ItemIsSelectable; switch (index.column()) { case 0: flags |= Qt::ItemIsUserCheckable; break; case 2: [[fallthrough]] case 3: [[fallthrough]] case 4: flags |= Qt::ItemIsEditable; break; } return flags; 的唯一背景......我做错了什么?

1 个答案:

答案 0 :(得分:10)

给出了这个神秘错误,因为[[fallthrough]]属性需要分号来终止它们。将case语句重写为

[[fallthrough]]

解决了错误。

相关问题