Skip to content

Possible dangling else with DLOG in non-debug mode #854

Closed
@anpol

Description

After #830, the following code starts misbehaving:

#define NDEBUG
#include "glog/logging.h"

int main()
{
  if (true)
    DLOG(ERROR) << "Hello";
  else
    LOG(ERROR) << "Bye";
}

This code now compiles with a warning, and prints "Bye".

Another possible issue with #830 is that DLOG now expands to a statement in non-debug mode, while being an expression in debug mode.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions