Anastasia created this revision.
Anastasia added a reviewer: rjmccall.
Herald added a subscriber: yaxunl.

This bug was pointed out in https://reviews.llvm.org/D55850#inline-496966


https://reviews.llvm.org/D56735

Files:
  lib/Sema/SemaOverload.cpp
  test/SemaOpenCLCXX/address_space_overloading.cl


Index: test/SemaOpenCLCXX/address_space_overloading.cl
===================================================================
--- /dev/null
+++ test/SemaOpenCLCXX/address_space_overloading.cl
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++
+
+// expected-no-diagnostics
+void foo(const __global int *a);
+void foo(const __generic int *a);
+
+void kernel ker() {
+  __global int *a;
+  __generic int *c;
+  __local int *d;
+  foo(a);
+  foo(c);
+  foo(d);
+}
Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -4019,7 +4019,8 @@
     // to unwrap. This essentially mimics what
     // IsQualificationConversion does, but here we're checking for a
     // strict subset of qualifiers.
-    if (T1.getCVRQualifiers() == T2.getCVRQualifiers())
+    if (T1.getCVRQualifiers() == T2.getCVRQualifiers() &&
+        T1.getAddressSpace() == T2.getAddressSpace())
       // The qualifiers are the same, so this doesn't tell us anything
       // about how the sequences rank.
       ;


Index: test/SemaOpenCLCXX/address_space_overloading.cl
===================================================================
--- /dev/null
+++ test/SemaOpenCLCXX/address_space_overloading.cl
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=c++
+
+// expected-no-diagnostics
+void foo(const __global int *a);
+void foo(const __generic int *a);
+
+void kernel ker() {
+  __global int *a;
+  __generic int *c;
+  __local int *d;
+  foo(a);
+  foo(c);
+  foo(d);
+}
Index: lib/Sema/SemaOverload.cpp
===================================================================
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -4019,7 +4019,8 @@
     // to unwrap. This essentially mimics what
     // IsQualificationConversion does, but here we're checking for a
     // strict subset of qualifiers.
-    if (T1.getCVRQualifiers() == T2.getCVRQualifiers())
+    if (T1.getCVRQualifiers() == T2.getCVRQualifiers() &&
+        T1.getAddressSpace() == T2.getAddressSpace())
       // The qualifiers are the same, so this doesn't tell us anything
       // about how the sequences rank.
       ;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to