title: Constexpr function in constexpr constructor initialiser list
body: <p>I would like to initialise a struct member with a hash of the struct name.</p>
  
  <pre><code>constexpr uint32_t myHash(const char* const data)
  { //Some code for hash
      return myHash;
  }
  
  struct My_Struct{
      constexpr Test() : ID(myHash("My_Struct"))
      {
      }
      const uint32_t ID; 
  }
  </code></pre>
  
  <p>When I have:</p>
  
  <pre><code>constexpr My_Struct my_constexpr_struct;
  </code></pre>
  
  <p>Then the hash is computed at compile time successfully. However, when I have in my main function </p>
  
  <pre><code>My_Struct my_normal_struct;
  </code></pre>
  
  <p>then it will call the</p>
  
  <pre><code>constexpr uint32_t myHash(const char* const data)
  </code></pre>
  
  <p>function in the code instead of simply initialising the struct member with a compile time constant.</p>
  
  <p>This would obviously incur a significant performance penalty that is avoidable.</p>
  
  <p>Any thoughts or suggestions on how to have the compiler perform this at compile time? I don't really want to do:</p>
  
  <pre><code>constexpr uint32_t MY_STRUCT_ID = myHash("My_Struct");
  struct My_Struct{
      constexpr Test() : ID(MY_STRUCT_ID)
      {
      }
      const uint32_t ID; 
  </code></pre>
  
  <p>Thanks.</p>