<html>
    <head>
      <base href="http://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 --- - int(::x) interpreted as a declaration but should it be interpreted as an expression?"
   href="http://llvm.org/bugs/show_bug.cgi?id=22633">22633</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>int(::x) interpreted as a declaration but should it be interpreted as an expression?
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </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++
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>yaghmour.shafik@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>Given the following code from this stackoverflow question
<a href="http://stackoverflow.com/q/24623071/1708801">http://stackoverflow.com/q/24623071/1708801</a> :

int x;

int main() {
    int(::x); //does not compile
    int(::x + 2); //compiles
}

clang rejects int(::x) since it is interpreting it as a declaration which is
obviously ill-formed. gcc on the other hand interprets it as an expression
statement and compiles the code. As far as I can tell section 6.8 [stmt.ambig]
says int(::x) should be a declaration.

Similar conclusion to bug report 4596:

  <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Declaration containing qualified-id interpreted as function-style cast"
   href="show_bug.cgi?id=4594">http://llvm.org/bugs/show_bug.cgi?id=4594</a>

I filed a gcc bug report:

  <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62116">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62116</a>

and the response was "Current G++ and EDG both treat it as the valid expression
(int)::x" which implies clang is incorrect.</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>