This is an archive of the discontinued LLVM Phabricator instance.

[Clang][OpenMP] Only check value if the expression is not instantiation dependent
ClosedPublic

Authored by tianshilei1992 on Oct 4 2022, 4:31 PM.

Details

Summary

Currently the following case fails:

template<typename Ty>
Ty foo(Ty *addr, Ty val) {
  Ty v;
#pragma omp atomic compare capture
  {
    v = *addr;
    if (*addr > val)
      *addr = val;
  }
  return v;
}

The compiler complains addr is not a lvalue. That's because when an expression
is instantiation dependent, we cannot tell if it is lvalue or not.

Diff Detail

Event Timeline

tianshilei1992 created this revision.Oct 4 2022, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 4:31 PM
tianshilei1992 requested review of this revision.Oct 4 2022, 4:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2022, 4:31 PM

Test is needed

This revision is now accepted and ready to land.Oct 5 2022, 5:15 AM
This revision was landed with ongoing or failed builds.Oct 5 2022, 5:45 AM
This revision was automatically updated to reflect the committed changes.
clang/lib/Sema/SemaOpenMP.cpp