<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/62596>62596</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang, trunk, c++11] Clang rejects NTTP defaulted value invoking static constexpr member function within class
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          CalebAdrianXYZ
      </td>
    </tr>
</table>

<pre>
    Given the following C++11 code: 
```cpp
// minimal reproducible example, oversimplified code
struct foo {
    static constexpr bool bar() {
        return true;
 }

    template<bool B = bar()> // <-- clang has issue with this
 static constexpr bool baz() {
        return true;
 }
};
static_assert(foo::baz(), "");
```

GCC, MSVC, ICC, and NVC++ all compile this code successfully, but Clang (trunk) produces the following diagnostic output:

```
<source>:7:23: error: non-type template argument is not a constant expression
    template<bool B = bar()> // <-- clang has issue with this
 ^~~~~
<source>:7:23: note: undefined function 'bar' cannot be used in a constant expression
<source>:3:27: note: declared here
    static constexpr bool bar() {
                          ^
<source>:12:15: error: no matching function for call to 'baz'
static_assert(foo::baz(), "");
              ^~~~~~~~
2 errors generated.
Compiler returned: 1
```

Corresponding CE link: https://godbolt.org/z/4Md1b5o8r

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VU9v47YT_TTUZZBAIi1LPujgyPbid9jFD-hi0fZSUOTIYkORAv84mxz82QtKXid12i3QRQnBskjOzHszb0juvToaxIaUD6TcZTyGwbqm5Rq7rXSKm59_-TXrrHxuPqgTGggDQm-1tk_KHKEl9IHQh6IAYSUStgWS70i-Jet8ecQ0XWbogdADjMqokWtwODkro1CdRsCvfJw0EtqCPaHzapy06hXKxets74OLIkBvLZDqYZkDAPCBByVAWOMDfp0cdNZq6LgjtCZ08-fNaTgM0RkILiJh39ZItbvAvO4NOE6aBySsnV0-AGG7V8eE7eHCibD27g6E5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