[cfe-commits] r86587 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/overloaded-builtin-operators.cpp
Fariborz Jahanian
fjahanian at apple.com
Mon Nov 9 13:02:06 PST 2009
Author: fjahanian
Date: Mon Nov 9 15:02:05 2009
New Revision: 86587
URL: http://llvm.org/viewvc/llvm-project?rev=86587&view=rev
Log:
For array pointee type, get its cvr qualifier from
its element type. Fixes pr5432.
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=86587&r1=86586&r2=86587&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Mon Nov 9 15:02:05 2009
@@ -2982,6 +2982,8 @@
QualType PointeeTy = PointerTy->getPointeeType();
unsigned BaseCVR = PointeeTy.getCVRQualifiers();
+ if (const ConstantArrayType *Array = PointeeTy->getAs<ConstantArrayType>())
+ BaseCVR = Array->getElementType().getCVRQualifiers();
bool hasVolatile = VisibleQuals.hasVolatile();
bool hasRestrict = VisibleQuals.hasRestrict();
Modified: cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp?rev=86587&r1=86586&r2=86587&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp (original)
+++ cfe/trunk/test/SemaCXX/overloaded-builtin-operators.cpp Mon Nov 9 15:02:05 2009
@@ -175,3 +175,13 @@
(void)(1.0f * a); // expected-error{{ambiguous}} \
// expected-note 81{{candidate}}
}
+
+// pr5432
+enum e {X};
+
+const int a[][2] = {{1}};
+
+int test_pr5432() {
+ return a[X][X];
+}
+
More information about the cfe-commits
mailing list