c++ - GoogleTest 1.7.0 `enum class` compile error -


when try , reference enum class test fixture, fails compile error ./gtest_mcp23s17.cpp:25:52: error: no type named 'hw_addr_6' in 'mcp23s17::hardwareaddress' tc_mcp23s17 _gpio_x(mcp23s17::hardwareaddress::hw_addr_6); ~~~~~~~~~~~~~~~~~~~~~~~~~~~^

however, if leave reference in test (leaving other code untouched), compiles without error , runs test expect. bug in googletest, or differentiates scenario far test concerned?

test (generic): [compiles]

test(construction, whenobjectisconstructedthenaddressparameterisstored) {     tc_mcp23s17 gpio_x(mcp23s17::hardwareaddress::hw_addr_6);     expect_eq(0x4c, gpio_x.getspibusaddress()); } 

test fixture: [compiles]

test_f(spitransfer, whenpinmodehasnotbeencalledthenthecallerschipselectpinishigh) {     tc_mcp23s17 gpio_x(mcp23s17::hardwareaddress::hw_addr_6);     expect_eq(high, getpinlatchvalue(ss)); } 

test fixture (with gpio_x declared in fixture class): [fails]

class spitransfer : public ::testing::test {   protected:     tc_mcp23s17 gpio_x(mcp23s17::hardwareaddress::hw_addr_6);     ... } test_f(spitransfer, whenpinmodehasnotbeencalledthenthecallerschipselectpinishigh) {     expect_eq(high, getpinlatchvalue(ss)); } 

a class member can initialised = or {}, not (). either of these should work:

tc_mcp23s17 gpio_x=mcp23s17::hardwareaddress::hw_addr_6; tc_mcp23s17 gpio_x{mcp23s17::hardwareaddress::hw_addr_6}; 

the rather unhelpful error message because compiler interprets use of () denote function declaration, gets confused because thing inside brackets isn't type.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -