https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85823

            Bug ID: 85823
           Summary: Boost.Tribool fails to compile: error:
                    '(tribool::dummy::nonnull != 0)' is not a constant
                    expression
           Product: gcc
           Version: 8.1.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

Reduced from 
https://github.com/boostorg/logic/pull/5#issuecomment-389965834

struct B {
  struct dummy {
    void nonnull() { }
  };
  using safe_bool = void (dummy::*)();

  constexpr B() : value(false) {}

  constexpr B(int) : value(true) {}

  constexpr operator safe_bool() const
  {
    return value ? &dummy::nonnull : 0;
  }

  bool value;
};

constexpr B operator!(B x)
{
  return x.value ? B() : B(1);
}

constexpr B tb_f{};
static_assert(!tb_f, "");



tribool.cc:25:15: error: non-constant condition for static assertion
 static_assert(!tb_f, "");
               ^~~~~
tribool.cc:25:25: error: '(B::dummy::nonnull != 0)' is not a constant
expression
 static_assert(!tb_f, "");
                         ^

Reply via email to