簡體   English   中英

GCC無法在可變參數概念模板類上編譯可變參數成員概念模板

[英]GCC fails to compile variadic member concept template on a variadic concept template class

想象一下,我有一個帶有可變參數概念模板成員的可變參數概念模板類。

#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

現場演示

這是GCC的錯誤,還是我在這里做錯了?

是的,這是一個錯誤。 輸出從字面上說是這樣,並要求您報告錯誤報告。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM