[Bug c++/106412] New: Code initializing static variables with local variables compiles without errors or warnings

menkaur at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 22 14:08:14 GMT 2022


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

            Bug ID: 106412
           Summary: Code initializing static variables with local
                    variables compiles without errors or warnings
           Product: gcc
           Version: og11 (devel/omp/gcc-11)
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: menkaur at gmail dot com
  Target Milestone: ---

Created attachment 53337
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53337&action=edit
minimal code example

Following code will compile without errors or warnings:


 int main(int argc, char **argv) {
       int i = 0, j = 0;
       static const auto s = i + j;
       return 0;
  }


The bug was found in gcc 12.1.0 on arch linux


More information about the Gcc-bugs mailing list