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

            Bug ID: 96975
           Summary: gcc cannot compile at -O0 but compiles at -O1/-O2/-O3
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, the following code is not compiled with -O0, but is compiled with
-O1/O2/O3.

$ cat s.cpp

typedef void (* A )();
template < A T > struct S { S (){}};
void T (){} S < T > a ;
int main (){
        void T ();
        S < T > a ;
}

$ g++ -c -O0 s.cpp
/tmp/cc1wgC6C.s:73: Error: symbol
`_ZN14CXXRecordDeclAIXadL_Z13FunctionDeclAvEEEC2Ev' is already defined

$ g++ -c -O2 s.cpp
success.

$ clang++ -c -O0 s.cpp
success.

Reply via email to