This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3adc9aeb250c: [OpenMP 5.0] Fix PR-45212: Shouldn't 
error out while using overloaded operator… (authored by cchen).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85563/new/

https://reviews.llvm.org/D85563

Files:
  clang/lib/Sema/SemaOpenMP.cpp
  clang/test/OpenMP/target_map_messages.cpp


Index: clang/test/OpenMP/target_map_messages.cpp
===================================================================
--- clang/test/OpenMP/target_map_messages.cpp
+++ clang/test/OpenMP/target_map_messages.cpp
@@ -499,6 +499,23 @@
 
 typedef int from;
 
+struct dim {
+  double x, y;
+};
+
+template<typename T>
+class Array1D
+{
+  public:
+    unsigned n1;
+    unsigned size;
+    T * dptr;
+
+    inline T& operator() (unsigned i1) { return dptr[i1]; }
+
+    Array1D() {n1=0;size=0;dptr=nullptr;}
+};
+
 template <typename T, int I> // expected-note {{declared here}}
 T tmain(T argc) {
   const T d = 5;
@@ -837,6 +854,16 @@
     Arr[0] = 2; // lt50-error {{original storage of expression in data 
environment is shared but data environment do not fully contain mapped 
expression storage}}
   }
 
+  Array1D<dim> pos;
+
+#pragma omp target enter data map(to:pos)
+#pragma omp target enter data map(to:pos.dptr[0:pos.size])
+#pragma omp target teams distribute parallel for
+  for(int i=0; i<100; i++) {
+    pos(i).x = i;
+    pos(i).y = i+1;
+  }
+
   return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in 
instantiation of function template specialization 'tmain<int, 3>' requested 
here}} expected-note {{in instantiation of function template specialization 
'tmain<int, 4>' requested here}}
 }
 #endif
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -16955,6 +16955,11 @@
     Components.emplace_back(CTE, nullptr);
     return true;
   }
+  bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr *COCE) {
+    assert(!RelevantExpr && "RelevantExpr is expected to be nullptr");
+    Components.emplace_back(COCE, nullptr);
+    return true;
+  }
   bool VisitStmt(Stmt *) {
     emitErrorMsg();
     return false;


Index: clang/test/OpenMP/target_map_messages.cpp
===================================================================
--- clang/test/OpenMP/target_map_messages.cpp
+++ clang/test/OpenMP/target_map_messages.cpp
@@ -499,6 +499,23 @@
 
 typedef int from;
 
+struct dim {
+  double x, y;
+};
+
+template<typename T>
+class Array1D
+{
+  public:
+    unsigned n1;
+    unsigned size;
+    T * dptr;
+
+    inline T& operator() (unsigned i1) { return dptr[i1]; }
+
+    Array1D() {n1=0;size=0;dptr=nullptr;}
+};
+
 template <typename T, int I> // expected-note {{declared here}}
 T tmain(T argc) {
   const T d = 5;
@@ -837,6 +854,16 @@
     Arr[0] = 2; // lt50-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
   }
 
+  Array1D<dim> pos;
+
+#pragma omp target enter data map(to:pos)
+#pragma omp target enter data map(to:pos.dptr[0:pos.size])
+#pragma omp target teams distribute parallel for
+  for(int i=0; i<100; i++) {
+    pos(i).x = i;
+    pos(i).y = i+1;
+  }
+
   return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
 }
 #endif
Index: clang/lib/Sema/SemaOpenMP.cpp
===================================================================
--- clang/lib/Sema/SemaOpenMP.cpp
+++ clang/lib/Sema/SemaOpenMP.cpp
@@ -16955,6 +16955,11 @@
     Components.emplace_back(CTE, nullptr);
     return true;
   }
+  bool VisitCXXOperatorCallExpr(CXXOperatorCallExpr *COCE) {
+    assert(!RelevantExpr && "RelevantExpr is expected to be nullptr");
+    Components.emplace_back(COCE, nullptr);
+    return true;
+  }
   bool VisitStmt(Stmt *) {
     emitErrorMsg();
     return false;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to