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

            Bug ID: 69872
           Summary: Wnarrowing note without warning/errror
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org
  Target Milestone: ---

struct s { int x, y; };
short offsets[1] = {
  ((char*) &(((struct s*)16)->y) - (char *)16), // { dg-message "narrowing" ""
{ target c++11 } }
};

$ g++ prog.cc -Wall -Wextra -std=gnu++1z -pedantic "-Wno-narrowing"

prog.cc:3:34: note:  the expression has a constant value but is not a C++
constant-expression
   ((char*) &(((struct s*)16)->y) - (char *)16), // { dg-message "narrowing" ""
{ target c++11 } }
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~

Reply via email to