New issue
Advanced search Search tips

Issue 815016 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Make it possible to do DCHECK_EQ(gfx::Size, gfx::Size).

Project Member Reported by afakhry@chromium.org, Feb 23 2018

Issue description

Right now this doesn't compile. It's possible in tests to do EXPECT_EQ(size1, size2). I think we need to hook up void PrintTo(const Size& size, ::std::ostream* os) somewhere in base/logging.

Assigning to danakj@ as owner of both gfx and base for triage.

../../base/logging.h:713:3: error: no matching function for call to 'MakeCheckOpValueString'
  MakeCheckOpValueString(&ss, v1);
  ^~~~~~~~~~~~~~~~~~~~~~
../../base/logging.h:761:1: note: in instantiation of function template specialization 'logging::MakeCheckOpString<gfx::Size, gfx::Size>' requested here
DEFINE_CHECK_OP_IMPL(EQ, ==)
^
../../base/logging.h:753:25: note: expanded from macro 'DEFINE_CHECK_OP_IMPL'
      return ::logging::MakeCheckOpString(v1, v2, names);                    \
                        ^
../../chrome/browser/ui/views/tabs/new_tab_button.cc:182:3: note: in instantiation of function template specialization 'logging::CheckEQImpl<gfx::Size, gfx::Size>' requested here
  DCHECK_EQ(ink_drop_layer->bounds().size(), GetVisibleBounds().size());
  ^
../../base/logging.h:936:31: note: expanded from macro 'DCHECK_EQ'
#define DCHECK_EQ(val1, val2) DCHECK_OP(EQ, ==, val1, val2)
                              ^
../../base/logging.h:890:18: note: expanded from macro 'DCHECK_OP'
      ::logging::Check##name##Impl((val1), (val2),                     \
                 ^
<scratch space>:32:1: note: expanded from here
CheckEQImpl
^
../../base/logging.h:703:18: note: candidate function not viable: no known conversion from 'const gfx::Size' to 'std::nullptr_t' (aka 'nullptr_t') for 2nd argument
BASE_EXPORT void MakeCheckOpValueString(std::ostream* os, std::nullptr_t p);
                 ^
../../base/logging.h:674:1: note: candidate template ignored: requirement 'base::internal::SupportsOstreamOperator<const Size &>::value' was not satisfied [with T = gfx::Size]
MakeCheckOpValueString(std::ostream* os, const T& v) {
^
../../base/logging.h:687:1: note: candidate template ignored: requirement 'std::is_function<typename std::remove_pointer<Size>::type>::value' was not satisfied [with T = gfx::Size]
MakeCheckOpValueString(std::ostream* os, const T& v) {
^
../../base/logging.h:698:1: note: candidate template ignored: requirement 'std::is_enum<Size>::value' was not satisfied [with T = gfx::Size]
MakeCheckOpValueString(std::ostream* os, const T& v) {
^
 

Comment 1 by danakj@chromium.org, Feb 23 2018

Cc: danakj@chromium.org
Owner: ----
Status: Available (was: Assigned)
You can DCHECK_EQ(gfx::Size().ToString(), gfx::Size().ToString()) meanwhile, or DCHECK_EQ the widths, and heights separately. I'm generally not interested in adding LOC to base/logging.h, esp for specific types. The error I think means it wants operator<<, but right now we have logging in a separate build target for tests. The style guide has changed to allow operator<< since.

However I don't think this is the right use of my time so won't be doing anything with it myself right now sorry.

Sign in to add a comment