"error: no viable conversion from tuple..." using make_tuple

"error: no viable conversion from tuple..." using make_tuple

我正在尝试使用函数 return std::tuple<Qstring, int>,但我遇到了这个编译器错误:

std::tuple<QString, int> foo()
{
    auto fst = getFst();
    auto snd = getSnd();
    return std::make_tuple(fst, snd);
}

`error: no viable conversion from 'tuple<[...], typename __make_tuple_return::type>' to 'tuple<[...], int>'``

我做错了什么?

这段代码没有任何问题。它编译没有任何问题。

$ cat t.C
#include <QString>
#include <tuple>

std::tuple<QString, int> foo()
{
    QString fst = QString("fst");
    int snd = 2;
    return std::make_tuple(fst, snd);
}
$ g++ -std=c++11 -I/usr/include/QtCore -c -o t.o t.C
$ g++ --version
g++ (GCC) 5.3.1 20151207 (Red Hat 5.3.1-2)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.