This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/82751] New: g++ 8 is breaking assert_lt (gtest) called from a lambda function


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82751

            Bug ID: 82751
           Summary: g++ 8 is breaking assert_lt (gtest) called from a
                    lambda function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sylvestre at debian dot org
  Target Milestone: ---

Created attachment 42490
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42490&action=edit
the ii file

With
---
#include "gtest/gtest.h"

TEST(foo, bar)
{
  const size_t kExpectedCount = 0;
  const size_t count = 0;
  auto f  = []() {
      ASSERT_LT(count, kExpectedCount);
    };
}
---

$ /usr/bin/g++-7      
-I/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include   
-fno-exceptions  TestNSPRLogModulesParser.cpp -c
$ /usr/bin/g++-8       -I/root/firefox-gcc-last/xpcom/tests/gtest
-I/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/xpcom/tests/gtest
-I/root/firefox-gcc-last/xpcom/base
-I/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include   
-fno-exceptions  TestNSPRLogModulesParser.cpp -c
In file included from
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/gtest/gtest.h:1874:0,
                 from TestNSPRLogModulesParser.cpp:1:
TestNSPRLogModulesParser.cpp: In lambda function:
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/gtest/gtest_pred_impl.h:147:45:
error: lvalue required as unary '&' operand
   GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
                                             ^
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/gtest/gtest_pred_impl.h:77:52:
note: in definition of macro 'GTEST_ASSERT_'
   if (const ::testing::AssertionResult gtest_ar = (expression)) \
                                                    ^~~~~~~~~~
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/gtest/gtest_pred_impl.h:166:3:
note: in expansion of macro 'GTEST_PRED_FORMAT2_'
   GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
   ^~~~~~~~~~~~~~~~~~~
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/gtest/gtest.h:1946:3:
note: in expansion of macro 'ASSERT_PRED_FORMAT2'
   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
   ^~~~~~~~~~~~~~~~~~~
/root/firefox-gcc-last/obj-x86_64-pc-linux-gnu/dist/include/gtest/gtest.h:1968:32:
note: in expansion of macro 'GTEST_ASSERT_LT'
 # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
                                ^~~~~~~~~~~~~~~
TestNSPRLogModulesParser.cpp:8:7: note: in expansion of macro 'ASSERT_LT'
       ASSERT_LT(count, kExpectedCount);
       ^~~~~~~~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]