summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-05-05 16:13:52 +0000
committerDouglas Gregor <dgregor@apple.com>2011-05-05 16:13:52 +0000
commit21673c4e7ec08457b53798b9879b7cc9a5909eb8 (patch)
tree07b139f6687feace3d931d1493d735cf0b57c8e1 /clang/lib
parent951471482cb05936993f6e43358dd0b55dadcb4c (diff)
downloadbcm5719-llvm-21673c4e7ec08457b53798b9879b7cc9a5909eb8.tar.gz
bcm5719-llvm-21673c4e7ec08457b53798b9879b7cc9a5909eb8.zip
Scoped enumerations should not be treated as integer types (in the C
sense). Fixes <rdar://problem/9366066> by eliminating an inconsistency between C++ overloading (which handled scoped enumerations correctly) and C binary operator type-checking (which didn't). llvm-svn: 130924
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Type.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 9eb497bea62..ed222355939 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -517,7 +517,7 @@ bool Type::isIntegerType() const {
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
// Incomplete enum types are not treated as integer types.
// FIXME: In C++, enum types are never integer types.
- return ET->getDecl()->isComplete();
+ return ET->getDecl()->isComplete() && !ET->getDecl()->isScoped();
return false;
}
@@ -641,7 +641,7 @@ bool Type::isSignedIntegerType() const {
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
// Incomplete enum types are not treated as integer types.
// FIXME: In C++, enum types are never integer types.
- if (ET->getDecl()->isComplete())
+ if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
return ET->getDecl()->getIntegerType()->isSignedIntegerType();
}
@@ -667,7 +667,7 @@ bool Type::isUnsignedIntegerType() const {
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType)) {
// Incomplete enum types are not treated as integer types.
// FIXME: In C++, enum types are never integer types.
- if (ET->getDecl()->isComplete())
+ if (ET->getDecl()->isComplete() && !ET->getDecl()->isScoped())
return ET->getDecl()->getIntegerType()->isUnsignedIntegerType();
}
OpenPOWER on IntegriCloud