<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - static method invocation via objects are not considered constexpr"
   href="https://llvm.org/bugs/show_bug.cgi?id=31624">31624</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>static method invocation via objects are not considered constexpr
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++14
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>matt@godbolt.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider the following (unusual) code:

struct Foo { static constexpr bool hasBar() { return true; } };

void test(const Foo &f) {
  static_assert(Foo::hasBar(), ""); // -is ok
  static_assert(f.hasBar(), ""); // fails on clang trunk 291576, works in GCC
}

(also on <a href="https://godbolt.org/g/qwzYvc">https://godbolt.org/g/qwzYvc</a> )

All clang versions I tested it on fail with "error: static_assert expression is
not an integral constant expression". GCC and CL both allow this and consider
the call to the static method hasBar via the actual object f to be constexpr.

It's not clear to me which behaviour is correct, though instinctively I'd
imagine it to be valid to allow such calls as constexpr.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>