]> granicus.if.org Git - clang/commitdiff
Fix assertion failure in self-host (and probably bogus template instantiation
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 19 Dec 2012 02:27:38 +0000 (02:27 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 19 Dec 2012 02:27:38 +0000 (02:27 +0000)
too). When instantiating a direct-initializer, if we find it has zero
arguments, produce an empty ParenListExpr rather than returning a null
expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170490 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/TreeTransform.h
test/SemaTemplate/instantiate-member-initializers.cpp

index 52f6c4d4c08a66d858f203084c8136918b70318d..c161d8cfcb2b0b06d375cc0aa2cf42c3bc0ae618 100644 (file)
@@ -2622,10 +2622,6 @@ ExprResult TreeTransform<Derived>::TransformInitializer(Expr *Init,
                                         Construct->getLocEnd(),
                                         Construct->getType());
 
-  // Treat an empty initializer like none.
-  if (NewArgs.empty())
-    return SemaRef.Owned((Expr*)0);
-
   // Build a ParenListExpr to represent anything else.
   SourceRange Parens = Construct->getParenRange();
   return getDerived().RebuildParenListExpr(Parens.getBegin(), NewArgs,
index 45503b38b38dae196532f4725bbdec39975c87d9..297ae917bb46369183e82bf09ccd4689f9fe18be 100644 (file)
@@ -25,3 +25,13 @@ public:
   BB() : AA<T>(1) {}
 };
 BB<int> x;
+
+struct X {
+  X();
+};
+template<typename T>
+struct Y {
+  Y() : x() {}
+  X x;
+};
+Y<int> y;