aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaOverload.cpp3
-rw-r--r--test/CodeGenCXX/PR5086-ambig-resolution-enum.cpp21
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 18614f7870..433ca79b48 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -887,6 +887,9 @@ static bool isNullPointerConstantForConversion(Expr *Expr,
Expr->getType()->isIntegralType())
return !InOverloadResolution;
+ if (Expr->getType()->isEnumeralType())
+ return !InOverloadResolution;
+
return Expr->isNullPointerConstant(Context,
InOverloadResolution? Expr::NPC_ValueDependentIsNotNull
: Expr::NPC_ValueDependentIsNull);
diff --git a/test/CodeGenCXX/PR5086-ambig-resolution-enum.cpp b/test/CodeGenCXX/PR5086-ambig-resolution-enum.cpp
new file mode 100644
index 0000000000..49bf7997b1
--- /dev/null
+++ b/test/CodeGenCXX/PR5086-ambig-resolution-enum.cpp
@@ -0,0 +1,21 @@
+// RUN: clang-cc -triple x86_64-apple-darwin -std=c++0x -S %s -o %t-64.s &&
+// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s &&
+// RUN: clang-cc -triple i386-apple-darwin -std=c++0x -S %s -o %t-32.s &&
+// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s &&
+// RUN: true
+
+class UnicodeString {
+public:
+ enum EInvariant { kInvariant };
+ int extract(int targetCapacity, enum EInvariant inv) const;
+ int extract(unsigned targetLength, const char *codepage) const;
+};
+
+void foo(const UnicodeString& id) {
+ enum {BUFLEN = 128 };
+ id.extract(BUFLEN - 2, UnicodeString::kInvariant);
+}
+
+// CHECK-LP64: call __ZNK13UnicodeString7extractEiNS_10EInvariantE
+
+// CHECK-LP32: call L__ZNK13UnicodeString7extractEiNS_10EInvariantE