<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Clang incorrectly considers dllimport pointers to member functions to be valid constant initializers"
   href="https://bugs.llvm.org/show_bug.cgi?id=33570">bug 33570</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>FIXED
           </td>
           <td>---
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>RESOLVED
           </td>
           <td>REOPENED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Clang incorrectly considers dllimport pointers to member functions to be valid constant initializers"
   href="https://bugs.llvm.org/show_bug.cgi?id=33570#c2">Comment # 2</a>
              on <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Clang incorrectly considers dllimport pointers to member functions to be valid constant initializers"
   href="https://bugs.llvm.org/show_bug.cgi?id=33570">bug 33570</a>
              from <span class="vcard"><a class="email" href="mailto:rnk@google.com" title="Reid Kleckner <rnk@google.com>"> <span class="fn">Reid Kleckner</span></a>
</span></b>
        <pre>I had to revert this, because it broke code like this:

struct __declspec(dllimport) Foo {
  int a;
  int get_a() { return a; }
};
template <int (Foo::*Getter)()> struct HasValue {
  int operator()(Foo *p) { return (p->*Getter)(); }
};

int main() {
  Foo f;
  f.a = 3;
  int x = HasValue<&Foo::get_a>()(&f);
}

Clang would say:

t.cpp:12:20: error: non-type template argument of type 'int (Foo::*)()' is not
a constant expression
  int x = HasValue<&Foo::get_a>()(&f);
                   ^~~~~~~~~~~
t.cpp:5:22: note: template parameter is declared here
template <int (Foo::*Getter)()> struct HasValue {
                     ^
1 error generated.</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>