Created attachment 13501 [details] test case Fuzzing discovered that the attached test case, when given as input to clang -fno-crash-diagnostics -std=c++11 -xc++ -c -emit-llvm causes this assertion failure: clang-3.6: tools/clang/include/clang/AST/Decl.h:2299: void clang::FieldDecl::setInClassInitializer(clang::Expr *): Assertion `hasInClassInitializer() && InitStorage.getPointer() == nullptr && "bit width, initializer or captured type already set"' failed.
cleaned up a bit: template <typename> struct e { operator int(); int np1 = e(); }; e<int> a = e<int>(); GCC and MSVC both accept (but generate code that may infinitely recurse).
Richard, it looks like we keep instantiating the same template over and over again. Any ideas?
We now reject: C:/Users/rnk/Downloads/funs-without-prototype.cpp:1:28: error: default member initializer for 'np1' uses itself template <typename> struct e { ^ C:/Users/rnk/Downloads/funs-without-prototype.cpp:1:28: note: in instantiation of default member initializer 'e<int>::np1' requested here C:/Users/rnk/Downloads/funs-without-prototype.cpp:1:28: note: in instantiation of default member initializer 'e<int>::np1' requested here C:/Users/rnk/Downloads/funs-without-prototype.cpp:3:13: note: implicit default constructor for 'e<int>' first required here int np1 = e(); ^ C:/Users/rnk/Downloads/funs-without-prototype.cpp:5:12: note: implicit default constructor for 'e<int>' first required here e<int> a = e<int>(); ^