HomePhabricator

[Diagnostics] Warn for std::is_constant_evaluated in constexpr mode

Authored by xbolva00 on Oct 29 2019, 11:06 AM.

Description

[Diagnostics] Warn for std::is_constant_evaluated in constexpr mode

Summary:
constexpr int fn1() {

if constexpr (std::is_constant_evaluated()) // condition is always true!
  return 0;
else
  return 1;

}

constexpr int fn2() {

if (std::is_constant_evaluated())
  return 0;
else
  return 1;

}

Solves PR42977

Reviewers: rsmith, aaron.ballman

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D69518