[gcc 4.7.2] bug avec template variadique
Bonjour,
Je pense être tombé sur un bug de gcc 4.7, mais avant de le rapporter j'aimerais savoir s'il a été résolu avec gcc 4.8 (que je n'arrive malheureusement pas à installer sur ma machine). Si quelqu'un passe par ici avec un gcc 4.8, ça serait sympa de me dire ce que ça donne chez vous :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| #include <type_traits>
template<typename ... Args>
struct make_return_t {
static void make(const Args&... i) {}
};
template<typename ... Args>
using make_return = make_return_t<typename std::decay<Args>::type...>;
struct vec {
template<typename ... Args>
void operator () (const Args& ... i) {
make_return<Args...>::make(i...);
}
};
int main() {
// make_return<float, int>::make(0.0f,1);
vec v;
v(0.0f,1);
return 0;
} |
Citation:
g++ -g -Wall -std=c++0x main.cpp -o main
Citation:
> g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.7.2-2ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Ubuntu/Linaro 4.7.2-2ubuntu1)
Voici l'erreur chez moi :
Citation:
main.cpp: In instantiation of ‘void vec::operator()(const Args& ...) [with Args = {float, int}]’:
main.cpp:23:13: required from here
main.cpp:10:70: error: wrong number of template arguments (2, should be 1)
In file included from main.cpp:1:0:
/usr/include/c++/4.7/type_traits:1677:11: error: provided for ‘template<class _Tp> class std::decay’
Dé-commenter la première ligne du main fait disparaître l'erreur, et le code compile dans les deux cas avec clang.