[prev in list] [next in list] [prev in thread] [next in thread]
List: cfe-dev
Subject: [cfe-dev] Clang compile error
From: Robert Ankeney <rrankene () gmail ! com>
Date: 2013-08-09 12:42:00
Message-ID: CAJL6GZoqk_B+63HSHJuWcAe-AYxSyo2BZHE-ruD3zPkvEvkK3w () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
I was trying to use clang to compile some Qt 5.1.0 code and came across a
compile error when including the file QtCore/qabstractitemmodel.h.
Simplyfying the code, I created bar.cpp:
class bar
{
friend int foo(int seed = 0);
};
inline int foo(int seed) { return seed; }
int main()
{
bar bletch;
}
The error I get using clang version 3.4 (trunk 187329) is:
bar.cpp:3:14: error: friend declaration specifying a default argument must
be a definition
friend int foo(int seed = 0);
^
bar.cpp:6:12: error: friend declaration specifying a default argument must
be the only declaration
inline int foo(int seed) { return seed; }
^
bar.cpp:3:14: note: previous declaration is here
friend int foo(int seed = 0);
^
2 errors generated.
Moving the initializer "seed = 0" from the friend declaration to the inline
declaration compiles without problem.
This code compiles fine with clang 3.3 and gcc 4.7.3.
Robert Ankeney
[Attachment #5 (text/html)]
I was trying to use clang to compile some Qt 5.1.0 code and came across a compile \
error when including the file QtCore/qabstractitemmodel.h.<br><br>Simplyfying the \
code, I created bar.cpp:<br><br>class bar<br>{<br> friend int foo(int seed = 0);<br> \
};<br><br>inline int foo(int seed) { return seed; }<br><br>int main()<br>{<br> bar \
bletch;<br>}<br><br>The error I get using clang version 3.4 (trunk 187329) \
is:<br><br>bar.cpp:3:14: error: friend declaration specifying a default argument must \
be a definition<br> friend int foo(int seed = 0);<br> ^<br>bar.cpp:6:12: \
error: friend declaration specifying a default argument must be the only \
declaration<br>inline int foo(int seed) { return seed; }<br> \
^<br>bar.cpp:3:14: note: previous declaration is here<br> friend int foo(int seed = \
0);<br> ^<br>2 errors generated.<br><br>Moving the initializer "seed \
= 0" from the friend declaration to the inline declaration compiles without \
problem.<br><br>This code compiles fine with clang 3.3 and gcc 4.7.3.<br> <br>Robert \
Ankeney<br><br>
_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic