Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/132.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ MSVC 15.5预览版2中的折叠表达式_C++_Visual C++_C++17 - Fatal编程技术网

C++ MSVC 15.5预览版2中的折叠表达式

C++ MSVC 15.5预览版2中的折叠表达式,c++,visual-c++,c++17,C++,Visual C++,C++17,Visual Studio的最新预览版本声称支持折叠表达式。但是,以下代码未编译: template<class T> struct L { void g() { } }; template<class... TT> struct B { std::tuple<L<TT>...> ss; void f(); //void f() //{ // (std::get<L<TT>&

Visual Studio的最新预览版本声称支持折叠表达式。但是,以下代码未编译:

template<class T> struct L
{
    void g() { }
};

template<class... TT> struct B
{
    std::tuple<L<TT>...> ss;

    void f();

    //void f()
    //{
    //  (std::get<L<TT>>(ss).g(), ...);
    //}
};

template<class... TT> void B<TT...>::f()
{
    (std::get<L<TT>>(ss).g(), ...);
}

int main()
{
    B<int, double> b;
    b.f();
}
模板结构
{
void g(){}
};
模板结构B
{
std::元组ss;
无效f();
//void f()
//{
//(std::get(ss).g(),…);
//}
};
模板无效B::f()
{
(std::get(ss).g(),…);
}
int main()
{
B B;
b、 f();
}
错误是:

22 : <source>(22): error C3520: 'TT': parameter pack must be expanded in this context
21 : <source>(21): note: while compiling class template member function 'void B<int,double>::f(void)'
28 : <source>(28): note: see reference to function template instantiation 'void B<int,double>::f(void)' being compiled
27 : <source>(27): note: see reference to class template instantiation 'B<int,double>' being compiled
22 : <source>(22): error C2228: left of '.g' must have class/struct/union
22 : <source>(22): error C2059: syntax error: '...'
22:(22):错误C3520:“TT”:必须在此上下文中展开参数包
21:(21):注意:编译类模板成员函数“void B::f(void)”时
28:(28):注意:参见正在编译的函数模板实例化“void B::f(void)”的参考
27:(27):注意:请参阅对正在编译的类模板实例化“B”的引用
22:(22):错误C2228:“.g”的左侧必须具有类/结构/联合
22:(22):错误C2059:语法错误:“…”
但是,如果我将
f()
的定义移到结构中,一切都会好起来。我对GCC没有这样的问题


这是MSVC折叠表达式实现中的错误吗?

是的,错误。请提交错误报告。@Barry谢谢。我会的。