Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ULib test fails #86

Open
aldanor opened this issue May 31, 2017 · 3 comments
Open

ULib test fails #86

aldanor opened this issue May 31, 2017 · 3 comments

Comments

@aldanor
Copy link

aldanor commented May 31, 2017

(I've ran ./configure --disable-shared && make, same as in travis config)

This is on OS X:

./../src/tests/ULibtest.cpp:47:23: error: calling 'begin' with incomplete return type 'UValueIter'
                        for (auto const& i : val)
                                           ^
../../thirdparty/ULib/include/ulib/json/value.h:841:22: note: 'begin' declared here
   friend UValueIter begin(const union jval);
                     ^
../../thirdparty/ULib/include/ulib/json/value.h:63:7: note: forward declaration of 'UValueIter'
class UValueIter;
      ^
../../src/tests/ULibtest.cpp:47:23: note: when looking up 'begin' function for range expression of type
      'const UValue::jval'
                        for (auto const& i : val)
                                           ^
../../src/tests/ULibtest.cpp:60:23: error: calling 'begin' with incomplete return type 'UValueIter'
                        for (auto const& i : val)
@miloyip
Copy link
Owner

miloyip commented Jun 1, 2017

@stefanocasazza

@stefanocasazza
Copy link
Contributor

@aldanor
I seem to understand that your compiler does not support CXX11, so can you apply this patch:

--- ULibtest.cpp	2017-03-24 16:10:17.000000000 +0100
+++ ULibtest.cpp.new	2017-06-01 13:24:39.925727535 +0200
@@ -44,12 +44,21 @@
 			{
 			stat.arrayCount++;
 
+#		if defined(U_STDCPP_ENABLE) && defined(HAVE_CXX11)
 			for (auto const& i : val)
 				{
 				stat.elementCount++;
 
 				GenStat(stat, i.getValue());
 				}
+#		else
+			for (UValue* i = UValue::toNode(val.ival); i; i = i->next)
+				{
+				stat.elementCount++;
+
+				GenStat(stat, i->getValue());
+				}
+#		endif
 			}
 		break;
 
@@ -57,6 +66,7 @@
 			{
 			stat.objectCount++;
 
+#		if defined(U_STDCPP_ENABLE) && defined(HAVE_CXX11)
 			for (auto const& i : val)
 				{
 				stat.memberCount++;
@@ -65,6 +75,16 @@
 
 				GenStat(stat, i.getValue());
 				}
+#		else
+			for (UValue* i = UValue::toNode(val.ival); i; i = i->next)
+				{
+				stat.memberCount++;
+				stat.stringCount++; // Key
+				stat.stringLength += UValue::getStringSize(i->getKey());
+
+				GenStat(stat, i->getValue());
+				}
+#		endif
 			}
 		break;
 		}

@boazsegev
Copy link
Contributor

@stefanocasazza ,

The error persists.

It's 2020 and I get the error with an updated Xcode compiler (Clang based on LLVM 9, which Apple versions as 11.0.3)...

...isn't it time to fix the default implementation instead of asking developers to patch the repo themselves?

B.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants