Skip to content

Commit

Permalink
GCC 4.7 in experimental C++11 mode tokenises '<::' at the beginning o…
Browse files Browse the repository at this point in the history
…f a template argument list or *_cast conversion incorrectly as the digraph '<:' (meaning '[') followed by a single ':'; the former can be resolved by -fpermissive, the latter isn't
  • Loading branch information
garethsb committed Nov 21, 2017
1 parent fc1f692 commit c42a369
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(LD_FLAGS "${LD_FLAGS} -Wl,-z,defs")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif()

elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
message("-- Setting msvc options")
Expand Down
6 changes: 3 additions & 3 deletions Release/tests/functional/json/parsing_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ TEST(escaping_control_characters)

for (int i : chars)
{
::utility::stringstream_t ss;
utility::stringstream_t ss;
ss << U("\"\\u") << std::uppercase << std::setfill(U('0')) << std::setw(4) << std::hex << i << U("\"");
const auto &str = ss.str();
auto expectedStr = str;
Expand Down Expand Up @@ -257,8 +257,8 @@ TEST(escaping_control_characters)
}

// Try constructing a json string value directly.
::utility::string_t schar;
schar.push_back(static_cast<::utility::string_t::value_type>(i));
utility::string_t schar;
schar.push_back(static_cast<utility::string_t::value_type>(i));
const auto &sv = json::value::string(schar);
VERIFY_ARE_EQUAL(expectedStr, sv.serialize());

Expand Down

0 comments on commit c42a369

Please sign in to comment.