This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/57196] [4.8 regression] Bogus "aggregate ... has incomplete type and cannot be defined"


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]