【问题标题】:GCC fails to compile variadic member concept template on a variadic concept template classGCC 无法在可变参数概念模板类上编译可变参数成员概念模板
【发布时间】:2019-11-23 04:18:27
【问题描述】:

假设我有一个带有可变参数概念模板成员的可变参数概念模板类。

#include <type_traits>

template<typename T>
concept Arithmetic = std::is_arithmetic_v<T>;

template<Arithmetic... Scalars>
class Foo
{
public:
    template<Arithmetic... OtherScalars>
    Foo(OtherScalars&&... args)
    {

    }
};

上面的代码使用GCC (trunk) 编译失败,但使用Clang (experimental concepts) 编译通过。

GCC 编译器输出

source>: In instantiation of 'class Foo<int, float, double>':
<source>:20:33:   required from here
<source>:11:5: internal compiler error: in tsubst_constraint, at cp/constraint.cc:1949

   11 |     Foo(OtherScalars&&... args)
      |     ^~~

Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions.
ASM generation compiler returned: 1

LIVE DEMO

这是GCC 中的错误还是我在这里做错了什么?

【问题讨论】:

  • 在您的问题正文中包含编译错误消息是合适的。
  • @Wyck 好的,完成!
  • 内部编译器错误肯定是编译器中的错误
  • @ÖöTiib 我相信您可以将其发布为答案

标签: c++ gcc variadic-templates c++20 c++-concepts


【解决方案1】:

是的,这是一个错误。输出字面意思是这样,并要求您报告错误报告。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-02-17
    • 2021-12-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多