http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57196

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler at
                   |                            |googlemail dot com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> 
2013-05-07 20:52:28 UTC ---
Here a more simplified version that reproduces the problem:

//---------------------------------------
#include <initializer_list>

template<class T>
struct set {
  set() = default;
  set(std::initializer_list<T>){}
};

struct string {
  string(const char*){}
  ~string(){}
};

typedef decltype(sizeof(0)) size_t;

template <size_t> struct EqHelper { };

int IsNullLiteralHelper(...);

void Fn() {
  EqHelper<sizeof IsNullLiteralHelper(set<int>{1})>        eq1;  // ok
  EqHelper<sizeof IsNullLiteralHelper(set<string>())>      eq2;  // ok
  EqHelper<sizeof IsNullLiteralHelper(set<string>{"foo"})> eq3;  // error
}
//---------------------------------------

It seems to be relevant that string has a non-trivial destructor and that set
has an initializer-list constructor (When e.g. replacing
set(std::initializer_list<T>){} by set(T){} causes the code to be accepted)

Reply via email to