language: C++11 (gcc-4.7.2)
date: 368 days 23 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <vector>
 
void f(std::vector<double> v);
 
template <class T>
void g(T&& t)
{
  f(t);
}
 
int m()
{
  f({1, 2}); // that's OK
  g({1, 2}); // that's not
}
 
prog.cpp: In function 'int m()':
prog.cpp:14:11: warning: deducing 'T' as 'std::initializer_list<int>'
prog.cpp:6:6: warning:   in call to 'void g(T&&) [with T = std::initializer_list<int>]'
prog.cpp:14:11: warning:   (you can disable this with -fno-deduce-init-list)
prog.cpp: In function 'void g(T&&) [with T = std::initializer_list<int>]':
prog.cpp:14:11:   instantiated from here
prog.cpp:8:3: error: conversion from 'std::initializer_list<int>' to non-scalar type 'std::vector<double>' requested