<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 --- - typeof rejects initialiser expression"
   href="https://llvm.org/bugs/show_bug.cgi?id=25315">25315</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>typeof rejects initialiser expression
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.7
          </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>Frontend
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>michael@araneidae.co.uk
          </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>The following code:


extern void *blah(void *arg);

const void *test2(const void *arg)
{
    return blah( ( {
        union {
            typeof((*(const void * []) { (arg) })) _value;
            void * _cast;
        } _union;
        _union._value = ((*(const void * []) { (arg) }));
        _union._cast;
    } ) );
}


generates the error:


test.c:7:43: error: initializer element is not a compile-time constant
            typeof((*(const void * []) { (arg) })) _value;
                                          ^~~
1 error generated.


This code compiles just fine with gcc, and if the typeof(...) expression is
replaced (with const void *) clang compiles this ok as well.

By the way, <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang rejects nested struct-member-access-typeof"
   href="show_bug.cgi?id=11299">bug #11299</a> looks related, but I can't say if it really is.</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>