Closed AntAgna closed 3 years ago
Which update of VS2015 are you using? Lots of bugs were fixed in updates 2 & 3, including one I encountered with similar error messages. I recommend Update 3.
I don't think the problem is the array size. I think it is is some error in VS2015. Perhaps something to do with checking the array bounds?, e.g. https://github.com/billyquith/ponder/blob/master/test/ponder/arrayproperty.cpp#L171
If I make that change and compile using Xcode clang (3.8?) it compiles and fails, as expected:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pondertest is a Catch v1.5.6 host application.
Run with -? for options
-------------------------------------------------------------------------------
Property arrays can be read
-------------------------------------------------------------------------------
ponder/test/ponder/arrayproperty.cpp:167
...............................................................................
ponder/test/ponder/arrayproperty.cpp:171: FAILED:
REQUIRE_THROWS_AS( bools->get(object, 2) )
because no exception was thrown where one was expected:
===============================================================================
test cases: 56 | 55 passed | 1 failed
assertions: 1544 | 1543 passed | 1 failed
Program ended with exit code: 1
I think my visual studio is fully up to date : VS2015 Update 3 14.0.25431.01, with compiler version 19.00.24215.1
The problem is a bug in the compiler. I have reported the problem to Microsoft
Here is a simplified version of the code that also fails to compile : main.zip
Bummer. Maybe try VS2017? I believe a lot of work has been done on C++ and it supports many C++17 features. Hopefully that would mean other bugs have been fixed.
Thanks for the sample. I'll just paste it here for reference.
#include <ponder/classget.hpp>
#include <ponder/errors.hpp>
#include <ponder/arrayproperty.hpp>
#include <ponder/class.hpp>
#include <ponder/classbuilder.hpp>
struct ExampleStruct
{
static void declare(); // For introspection
int Array1[10];
};
PONDER_AUTO_TYPE(ExampleStruct, &ExampleStruct::declare) // Will automatically call declare()
inline void ExampleStruct::declare()
{
// Declare structure members
ponder::Class::declare< ExampleStruct >("ExampleStruct")
.property("Array1", &ExampleStruct::Array1)
;
}
int main()
{
const ponder::Class& Class = ponder::classByType<ExampleStruct>();
return 0;
}
I have tested with Visual Studio 2017 and the problem is also there.
If I take the code of this file : https://github.com/billyquith/ponder/blob/master/test/ponder/arrayproperty.cpp
And I modify
bool bools[2];
tobool bools[3];
And try to build using Visual Studio 2015 in x86 DebugI get this error :
Is there a way to use arrays larger than 2 apart from using std::array ?