public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/110424] New: Bogus ODR warning for FMV member function with -flto
@ 2023-06-27  1:00 wwwhhhyyy333 at gmail dot com
  0 siblings, 0 replies; only message in thread
From: wwwhhhyyy333 at gmail dot com @ 2023-06-27  1:00 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110424
           Summary: Bogus ODR warning for FMV member function with -flto
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wwwhhhyyy333 at gmail dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

cat m1.h

---
#pragma once 

class A      
{            
public:      
  int foo1();
};           
---

cat m1.cpp

---
#include "m1.h"                                                

__attribute__((target_clones("default","arch=icelake-server")))                 
int A::foo1()                                                  
{                                                              
    return 0;                                                  
}                                                              

---

cat m2.cpp

---
#include "m1.h"   

int main()        
{                 
  A a;            
  return a.foo1();
}                 
---

g++ -flto -Werror m1.cpp m2.cpp -o m2

m1.h:6:7: error: ‘foo1’ violates the C++ One Definition Rule [-Werror=odr]
    6 |   int foo1();                                                     
      |       ^                                                           
m1.cpp:9:1: note: ‘_ZN1A4foo1Ev’ was previously declared here             
    9 | }                                                                 
      | ^                                                                 
lto1: all warnings being treated as errors                                

The output binary should quite same as the one without lto, so the warning
seems to be bogus.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-27  1:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-27  1:00 [Bug lto/110424] New: Bogus ODR warning for FMV member function with -flto wwwhhhyyy333 at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).