[LLVMbugs] [Bug 13421] Clang fails to build unity-2d

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jul 20 08:28:17 PDT 2012


Douglas Gregor <dgregor at apple.com> changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Douglas Gregor <dgregor at apple.com> 2012-07-20 10:28:17 CDT ---
(In reply to comment #0)
> When building unity-2d with clang i get the following error
> In file included from
> /home/tsdgeos_work/unity-2d/unity-2d_trunk/libunity-2d-private/src/unity2ddeclarativeview.cpp:17:
> /home/tsdgeos_work/unity-2d/unity-2d_trunk/libunity-2d-private/src/unity2ddeclarativeview.h:58:124:
> error: expected ')'
>     void setSource(const QUrl& source, const QMap<const char*, QVariant>
> &rootObjectProperties = QMap<const char*, QVariant>());
>                                            ^

This is actually ill-formed code. Essentially, the rule for parsing default
arguments is that you parse all of the tokens up to the first non-nested ','.
So, according to C++, the default argument for rootObjectProperties is just

  QMap<const char*

and then the program is detected as ill-formed whe


doesn't parse properly as a third parameter.

GCC didn't (still doesn't? I don't know) implement this rule, because it was a
fairly recent clarification to the language.

The fix is to wrap the default argument in parentheses, so that the comma is

void setSource(const QUrl& source, const QMap<const char*, QVariant>
 &rootObjectProperties = (QMap<const char*, QVariant>()));

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list