Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

cpp library fails to build on FreeBSD in C++11 mode #67

Open
jbeich opened this issue Jan 12, 2017 · 2 comments
Open

cpp library fails to build on FreeBSD in C++11 mode #67

jbeich opened this issue Jan 12, 2017 · 2 comments

Comments

@jbeich
Copy link

jbeich commented Jan 12, 2017

FreeBSD defines NULL via nullptr in C++11 mode since 9.1-RELEASE (or freebsd/freebsd-src@c8ed04c26b67) which conflicts with reinterpret_cast<whatever>(NULL) expression. Maybe expand NULL to 0.

$ pkg info -x icu 'g.*test'
icu-58.2,1
googletest-1.8.0.11

$ c++ -v
FreeBSD clang version 4.0.0 (trunk 291476) (based on LLVM 4.0.0svn)
Target: x86_64-unknown-freebsd12.0
Thread model: posix
InstalledDir: /usr/bin
Found CUDA installation: /usr/local/cuda, version 7.5

$ CXXFLAGS='-std=c++11' cmake /path/to/sfntly/cpp
$ gmake
[...]
cpp/src/sample/subtly/utils.cc:82:22: error: reinterpret_cast from 'nullptr_t' to 'FILE *'
      (aka '__sFILE *') is not allowed
  if (output_file == reinterpret_cast<FILE*>(NULL))
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

cpp/src/sfntly/table/core/cmap_table.cc:442:21: error: reinterpret_cast from 'nullptr_t' to
      'sfntly::ReadableFontData *' is not allowed
    : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cpp/src/sfntly/table/core/cmap_table.cc:566:34: error: reinterpret_cast from 'nullptr_t' to
      'sfntly::WritableFontData *' is not allowed
                               : reinterpret_cast<WritableFontData*>(NULL),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cpp/src/sfntly/table/core/cmap_table.cc:577:34: error: reinterpret_cast from 'nullptr_t' to
      'sfntly::ReadableFontData *' is not allowed
                               : reinterpret_cast<ReadableFontData*>(NULL),
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cpp/src/sfntly/table/core/cmap_table.cc:961:21: error: reinterpret_cast from 'nullptr_t' to
      'sfntly::ReadableFontData *' is not allowed
    : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cpp/src/sfntly/table/core/cmap_table.cc:969:21: error: reinterpret_cast from 'nullptr_t' to
      'sfntly::ReadableFontData *' is not allowed
    : CMap::Builder(reinterpret_cast<ReadableFontData*>(NULL),
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 errors generated.

cpp/src/test/cmap_editing_test.cc:44:33: error: reinterpret_cast from 'nullptr_t' to
      'CMapTable::Builder *' is not allowed
  ASSERT_NE(cmap_table_builder, reinterpret_cast<CMapTable::Builder*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
cpp/src/test/cmap_editing_test.cc:98:19: error: reinterpret_cast from 'nullptr_t' to
      'CMapTable::CMap *' is not allowed
  ASSERT_NE(cmap, reinterpret_cast<CMapTable::CMap*>(NULL));
  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
2 errors generated.

cpp/src/test/cmap_iterator_test.cc:135:13: error: reinterpret_cast from 'nullptr_t' to
      'CMapTable::CMap::CharacterIterator *' is not allowed
            reinterpret_cast<CMapTable::CMap::CharacterIterator*>(NULL));
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1927:63: note: expanded from macro 'EXPECT_NE'
  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:162:40: note: expanded from macro 'EXPECT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
1 error generated.

cpp/src/test/cmap_test.cc:118:25: error: reinterpret_cast from 'nullptr_t' to 'FontArray *'
      (aka 'vector<Ptr<sfntly::Font> > *') is not allowed
  ASSERT_NE(font_array, reinterpret_cast<FontArray*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
cpp/src/test/cmap_test.cc:122:19: error: reinterpret_cast from 'nullptr_t' to
      'sfntly::Font *' is not allowed
  ASSERT_NE(font, reinterpret_cast<Font*>(NULL));
  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
cpp/src/test/cmap_test.cc:127:23: error: reinterpret_cast from 'nullptr_t' to
      'CMapTable::CMap *' is not allowed
  ASSERT_NE((cmap1_), reinterpret_cast<CMapTable::CMap*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
cpp/src/test/cmap_test.cc:130:23: error: reinterpret_cast from 'nullptr_t' to
      'CMapTable::CMap *' is not allowed
  ASSERT_NE((cmap2_), reinterpret_cast<CMapTable::CMap*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
4 errors generated.

cpp/src/test/test_font_utils.cc:73:25: error: reinterpret_cast from 'nullptr_t' to 'FILE *'
      (aka '__sFILE *') is not allowed
  EXPECT_NE(input_file, reinterpret_cast<FILE*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1927:63: note: expanded from macro 'EXPECT_NE'
  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:162:40: note: expanded from macro 'EXPECT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
cpp/src/test/test_font_utils.cc:93:26: error: reinterpret_cast from 'nullptr_t' to 'FILE *'
      (aka '__sFILE *') is not allowed
  EXPECT_NE(output_file, reinterpret_cast<FILE*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1927:63: note: expanded from macro 'EXPECT_NE'
  EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:162:40: note: expanded from macro 'EXPECT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
2 errors generated.

cpp/src/test/autogenerated/cmap_basic_test.cc:70:19: error: reinterpret_cast from
      'nullptr_t' to 'sfntly::Font *' is not allowed
  ASSERT_NE(font, reinterpret_cast<Font*>(NULL));
  ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
cpp/src/test/autogenerated/cmap_basic_test.cc:74:26: error: reinterpret_cast from
      'nullptr_t' to 'sfntly::CMapTable *' is not allowed
  ASSERT_NE(cmap_table_, reinterpret_cast<CMapTable*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
cpp/src/test/autogenerated/cmap_basic_test.cc:88:29: error: reinterpret_cast from
      'nullptr_t' to 'TiXmlAttribute *' is not allowed
  ASSERT_NE(num_cmaps_attr, reinterpret_cast<TiXmlAttribute*>(NULL));
  ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest.h:1960:54: note: expanded from macro 'ASSERT_NE'
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
                               ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest.h:1942:63: note: expanded from macro 'GTEST_ASSERT_NE'
  ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/local/include/gtest/gtest_pred_impl.h:166:40: note: expanded from macro 'ASSERT_PRED_FORMAT2'
  GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:147:43: note: expanded from macro 'GTEST_PRED_FORMAT2_'
  GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/usr/local/include/gtest/gtest_pred_impl.h:77:52: note: expanded from macro 'GTEST_ASSERT_'
  if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                   ^~~~~~~~~~
3 errors generated.
@jfkthame
Copy link
Contributor

Maybe expand NULL to 0.

I think a more idiomatic C++ solution would be to replace the use of

reinterpret_cast<PointerType>(NULL)

with

static_cast<PointerType>(nullptr)

throughout. Does this work as expected for you?

@jbeich
Copy link
Author

jbeich commented Jan 12, 2017

libc++ (from LLVM) provides a synthetic nullptr even in pre-C++11 mode but libstdc++ (from GCC) before 6.0 doesn't expose it unless -std=c++11 is explicitly passed. However, both work fine with static_cast<PointerType>(NULL).

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

No branches or pull requests

2 participants