LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 39149 - bugprone-use-after-move false positive on null statement in template
Summary: bugprone-use-after-move false positive on null statement in template
Status: RESOLVED FIXED
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: All All
: P normal
Assignee: Martin Böhme
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-02 02:27 PDT by Martin Böhme
Modified: 2018-10-04 04:39 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s): r343768


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Böhme 2018-10-02 02:27:08 PDT
bugprone-use-after-move issues a false positive diagnostic on this example:

namespace std {
template <typename a> void move(a &&);
}
template <class> void foo() {
  int c = 0;
  c;
  ;
  std::move(c);
}
template void foo<int>();

The reason for this is that the NullStmt is used in both the uninstantiated and the instantiated version of the function template. The NullStmt therefore has two parents; the current version of the sequencing code in ExprSequence cannot handle this, leading it to conclude incorrectly that the use and the move are unsequenced.