wangxiaowei0303 / rapidjson

Automatically exported from code.google.com/p/rapidjson
MIT License
0 stars 0 forks source link

Can't compile with Apple LLVM 4.0 Xcode 4.4 #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add rapidjson headers to xcode project.
2. Compile with LLVM 4.0 and xcode 4.4

What is the expected output?
Compile without errors.

What do you see instead?
Error in Document.h line 704:
"if (reader.Parse<parseFlags>(is, *this)) {"
"Semantic Issue: Reference to non-static member function must be called."

What version of the product are you using?
SVN version 18.

On what operating system?
OSX 10.7.4 with Xcode 4.4 and Apple LLVM 4.0

Please provide any additional information below.
It compiles without error using LLVM GCC 4.2

Original issue reported on code.google.com by ed.bart...@gmail.com on 26 Jul 2012 at 1:45

GoogleCodeExporter commented 9 years ago
I run into exactly the same issue. Here's the code and error:

#import "document.h" // Objective-C++

Document document;
char* buffer = NULL; // initialized somewhere else
if (document.ParseInsitu<0>(buffer).HasParseError())
 {
        return;
 }

////////////////////////////////
Error reported:

/Users/zhaojianyin2012/Dev/Feedzr2/Feedzr/rapidjson/document.h:704:7: Reference 
to non-static member function must be called

/Users/zhaojianyin2012/Dev/Feedzr2/Feedzr/GoogleEngine.mm:26:9: In file 
included from 
/Users/zhaojianyin2012/Dev/Feedzr2/Feedzr/Feedzr/../GoogleEngine.mm:26:

/Users/zhaojianyin2012/Dev/Feedzr2/Feedzr/rapidjson/document.h:726:10: In 
instantiation of function template specialization 
'rapidjson::GenericDocument<rapidjson::UTF8<char>, 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::ParseStream<1, 
rapidjson::UTF8<char>, 
rapidjson::GenericInsituStringStream<rapidjson::UTF8<char>> >' requested here

/Users/zhaojianyin2012/Dev/Feedzr2/Feedzr/rapidjson/document.h:731:10: In 
instantiation of function template specialization 
'rapidjson::GenericDocument<rapidjson::UTF8<char>, 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::ParseInsitu<0, 
rapidjson::UTF8<char> >' requested here

/Users/zhaojianyin2012/Dev/Feedzr2/Feedzr/GoogleEngine.mm:774:22: In 
instantiation of function template specialization 
'rapidjson::GenericDocument<rapidjson::UTF8<char>, 
rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >::ParseInsitu<0>' 
requested here

Original comment by zhaojian...@gmail.com on 7 Aug 2012 at 6:42

GoogleCodeExporter commented 9 years ago
I find out that by changing Line:703
from: 
GenericReader<SourceEncoding, Encoding> reader;
to:
GenericReader<rapidjson::UTF8<char>, rapidjson::UTF8<char>> reader;
will silent the clang complier from reporting error.

Original comment by zhaojian...@gmail.com on 8 Aug 2012 at 10:11

GoogleCodeExporter commented 9 years ago
I have fixed the same problem by replacing 
(apidjson/include/rapidjson/document.h:704)

"if (reader.Parse<parseFlags>(is, *this)) {"

with:

"if (reader.template Parse<parseFlags>(is, *this)) {"

Original comment by m.neg...@gmail.com on 28 Aug 2012 at 9:35

GoogleCodeExporter commented 9 years ago
m.negram's suggested patch is 100% correct; we've independently come up with 
the same patch ourselves. Could some maintainer please apply it to trunk?

Original comment by art...@push.am on 16 Oct 2012 at 9:58

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r70.

Original comment by milo...@gmail.com on 13 Nov 2012 at 9:46

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r71.

Original comment by milo...@gmail.com on 13 Nov 2012 at 9:48

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 22ddf37cf094.

Original comment by milo...@gmail.com on 6 Jun 2014 at 6:04