<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Inherited constructor unusable for constexpr static member of class template"
   href="https://bugs.llvm.org/show_bug.cgi?id=47555">47555</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Inherited constructor unusable for constexpr static member of class template
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>10.0
          </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++17
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>feodor.alexeev@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given the code (godbolt link <a href="https://godbolt.org/z/dc1G1W">https://godbolt.org/z/dc1G1W</a>):


struct Storage {
    explicit constexpr Storage(int) {}
};

struct Derived : Storage {
    using Storage::Storage;
};

// static Derived kInstance{1};

template<typename>
struct Template {
    static constexpr Derived kDerived{0};
};


Both clang 10.0.1 and current clang trunk (reported as 12.0.0) on Compiler
Explorer emit the following error:


<source>:13:30: error: constexpr variable 'kDerived' must be initialized by a
constant expression
    static constexpr Derived kDerived{0};
                             ^~~~~~~~~~~
<source>:13:30: note: constructor inherited from base class 'Storage' cannot be
used in a constant expression; derived class cannot be implicitly initialized
<source>:6:20: note: declared here
    using Storage::Storage;
                   ^


Worth noting, uncommenting the line "static Derived kInstant{1};" or commenting
out "template<typename>" makes code compile.</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>