[cfe-commits] r170490 - in /cfe/trunk: lib/Sema/TreeTransform.h test/SemaTemplate/instantiate-member-initializers.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Tue Dec 18 18:27:38 PST 2012
Author: rsmith
Date: Tue Dec 18 20:27:38 2012
New Revision: 170490
URL: http://llvm.org/viewvc/llvm-project?rev=170490&view=rev
Log:
Fix assertion failure in self-host (and probably bogus template instantiation
too). When instantiating a direct-initializer, if we find it has zero
arguments, produce an empty ParenListExpr rather than returning a null
expression.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaTemplate/instantiate-member-initializers.cpp
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=170490&r1=170489&r2=170490&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Dec 18 20:27:38 2012
@@ -2622,10 +2622,6 @@
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,
Modified: cfe/trunk/test/SemaTemplate/instantiate-member-initializers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-member-initializers.cpp?rev=170490&r1=170489&r2=170490&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-member-initializers.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-member-initializers.cpp Tue Dec 18 20:27:38 2012
@@ -25,3 +25,13 @@
BB() : AA<T>(1) {}
};
BB<int> x;
+
+struct X {
+ X();
+};
+template<typename T>
+struct Y {
+ Y() : x() {}
+ X x;
+};
+Y<int> y;
More information about the cfe-commits
mailing list