[cfe-commits] r109356 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaTemplate/dependent-base-member-init.cpp
Eli Friedman
eli.friedman at gmail.com
Sat Jul 24 14:19:15 PDT 2010
Author: efriedma
Date: Sat Jul 24 16:19:15 2010
New Revision: 109356
URL: http://llvm.org/viewvc/llvm-project?rev=109356&view=rev
Log:
PR7698: Make sure we correctly handle the initialization of an array with
dependent size.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/SemaTemplate/dependent-base-member-init.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=109356&r1=109355&r2=109356&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Jul 24 16:19:15 2010
@@ -1285,10 +1285,7 @@
for (unsigned i = 0; i < NumArgs; i++)
HasDependentArg |= Args[i]->isTypeDependent();
- QualType FieldType = Member->getType();
- if (const ArrayType *Array = Context.getAsArrayType(FieldType))
- FieldType = Array->getElementType();
- if (FieldType->isDependentType() || HasDependentArg) {
+ if (Member->getType()->isDependentType() || HasDependentArg) {
// Can't check initialization for a member of dependent type or when
// any of the arguments are type-dependent expressions.
OwningExprResult Init
Modified: cfe/trunk/test/SemaTemplate/dependent-base-member-init.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/dependent-base-member-init.cpp?rev=109356&r1=109355&r2=109356&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/dependent-base-member-init.cpp (original)
+++ cfe/trunk/test/SemaTemplate/dependent-base-member-init.cpp Sat Jul 24 16:19:15 2010
@@ -57,3 +57,12 @@
struct X0 : T::template apply<U> {
X0(int i) : T::template apply<U>(i) { }
};
+
+// PR7698
+namespace PR7698 {
+ template<typename Type>
+ class A {
+ char mA[sizeof(Type *)];
+ A(): mA() {}
+ };
+}
More information about the cfe-commits
mailing list