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

            Bug ID: 85775
           Summary: False positive with -Wparentheses
           Product: gcc
           Version: 8.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: insertinterestingnamehere at gmail dot com
  Target Milestone: ---

g++ 8.1 warns about unnecessary parentheses in some cases where they are
actually needed to designate something as a single argument to a macro. Here's
a minimal example:

#define M(x) x

template <typename T, typename S>
struct A {
static const volatile char *M(B);
};

template <typename T, typename S>
const volatile char *M((A<T, S>::B)) = nullptr;


As it stands, the compiler warns that the double parentheses are unnecessary,
but if they are removed the preprocessor complains that two arguments are being
passed to a macro that only expects one. The only work around, for now, is to
locally disable the warning with pragmas.

Reply via email to