<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 --- - unexpected syntax error: operator[] mistaken for lambda capture" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24161&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=gdfI5iBbrVEi7ZHHbxVUZR_99j4B-Pv9DaJM4952Udo&s=MQGn1iOzYeVKI4eVi8qbyqErOlI8zX7lEq_WtcHQpYo&e=">24161</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>unexpected syntax error: operator[] mistaken for lambda capture
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </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++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>sherm1@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14603" name="attach_14603" title="Reproduces unexpected syntax error">attachment 14603</a> <a href="attachment.cgi?id=14603&action=edit" title="Reproduces unexpected syntax error">[details]</a></span>
Reproduces unexpected syntax error

Vec is a class that has a default constructor and operator[](int) defined. This
construct (resulting from a macro expansion) fails to compile with clang 3.4
C++11, but succeeds with gcc 4.8.2 and VS2015:

if ((std::abs(((Vec())[0]))/3. > 0))
   printf("hi\n");

The error is:

c++ -std=c++11 crash2.cpp
crash2.cpp:61:28: error: expected variable name or 'this' in lambda capture
list
    if ((std::abs(((Vec())[0]))/3. > 0))
                           ^

Removing the extra set of parentheses around Vec() eliminates the error.

I've attached a complete program that fails to 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>