Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang misinterprets initialization #18809

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR18810
Status NEW
Importance P normal
Reported by Dominik Strasser (dominik.strasser@onespin-solutions.com)
Reported on 2014-02-12 03:50:41 -0800
Last modified on 2014-02-12 10:46:07 -0800
Version 3.4
Hardware PC Linux
CC dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments foo.C (259 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 12049
Testcase

The attached test case can't be compiled by clang but passes without any
hassles in g++ and the Oracle/Sunstudio C++ compiler.

The primary error message is:
foo.C:37:34: error: parameter declarator cannot be qualified
  QCursor waitCursor(QCursor(Qt::WaitCursor));

The attached test case is a common Qt usage in our tools. I have removed
everything and only left the needed declarations.
Quuxplusone commented 10 years ago

Attached foo.C (259 bytes, application/octet-stream): Testcase

Quuxplusone commented 10 years ago

Clang is correct here.

Your declaration disambiguates as a function declaration, not as a variable declaration. The disambiguation process doesn't take into account whether function parameter declarations are qualified or unqualified (because that is governed by semantic rules, not by the grammar).

That said, we should diagnose this better, especially since other implementations accept it. I'll also raise this with the C++ CWG and see if we can get a language change to accept this.