[LLVMbugs] [Bug 22633] New: int(::x) interpreted as a declaration but should it be interpreted as an expression?
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Feb 19 07:58:46 PST 2015
http://llvm.org/bugs/show_bug.cgi?id=22633
Bug ID: 22633
Summary: int(::x) interpreted as a declaration but should it be
interpreted as an expression?
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: yaghmour.shafik at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
Given the following code from this stackoverflow question
http://stackoverflow.com/q/24623071/1708801 :
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:
http://llvm.org/bugs/show_bug.cgi?id=4594
I filed a gcc bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62116
and the response was "Current G++ and EDG both treat it as the valid expression
(int)::x" which implies clang is incorrect.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150219/37f48d83/attachment.html>
More information about the llvm-bugs
mailing list