OK, well, I guess it's fine to go ahead then.

Richard


On 04/09/2012 10:56 AM, Vincent van Ravesteijn wrote:
Op 9-4-2012 15:53, Richard Heck schreef:
On 04/09/2012 09:09 AM, Vincent van Ravesteijn wrote:
Op 7-12-2011 17:03, kuem...@lyx.org schreef:
Author: kuemmel
Date: Wed Dec 7 17:03:37 2011
New Revision: 40417
URL: http://www.lyx.org/trac/changeset/40417

Log:
clang: std::string is used here, fwd is not enough

Modified:
lyx-devel/trunk/src/Lexer.h

Modified: lyx-devel/trunk/src/Lexer.h
==============================================================================
--- lyx-devel/trunk/src/Lexer.h Wed Dec 7 16:17:06 2011 (r40416)
+++ lyx-devel/trunk/src/Lexer.h Wed Dec 7 17:03:37 2011 (r40417)
@@ -18,7 +18,7 @@
#define LEXER_H

#include "support/strfwd.h"
-
+#include<string>

namespace lyx {


Also for branch ?

There are multiple (2) reports that clang can't compile LyX:
- https://trac.macports.org/ticket/32109
- http://thread.gmane.org/gmane.editors.lyx.devel/141322

It'd be nice if we had more information. Lexer.h is included in a lot of other files,
and this will include <string> now in all of them.


Lexer.h is only included in *.cpp files, so it won't be a big problem.

Quoting from http://sourceforge.net/tracker/index.php?func=detail&aid=3400141&group_id=146814&atid=766244:

"Let me explain, why the clang behavious is correct, and gcc behaviour,
which passes this code, is not.
According to the §8.5.3/5:
--------
— If the initializer expression is an rvalue, with T2 a class type, and
“cv1 T1” is reference-compatible with “cv2 T2,” the reference is
bound in one of the following ways (the choice is implementation-defined):
—— The reference is bound to the object represented by the rvalue (see
3.10) or to a sub-object within that object.
—— A temporary of type “cv1 T2” [sic] is created, and a constructor
is called to copy the entire rvalue object into the temporary. The
reference is bound to the temporary or to a sub-object within the
temporary.

The constructor that would be used to make the copy shall be callable
whether or not the copy is actually done.
--------

There is no std::basic_string copy c'tor available in _locale.h (as there
is no std::basic_string definition avalilable), so, binding of std::string
to const std::string& is forbidded at
http://stlport.git.sourceforge.net/git/gitweb.cgi?p=stlport/stlport;a=blob;f=stlport/stl/_locale.h;h=43ead630a7d77671e52cfc01d8868434b8fbafb4;hb=refs/heads/master#l155
and compilation shall fail."



Is there any way to test for clang? If not, does it make any sense to include
strfwd.h if we're also including <string>?


We need it for docstring probably.

Richard

Vincent

Reply via email to