[Bug c++/92986] ODR violation not detected

2019-12-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92986 --- Comment #7 from Jakub Jelinek --- We could in theory save the tokens of each method and compare them, but it would be quite costly. Normally people don't cut'n'paste classes between TUs, but rather just declare them once in a header they incl

[Bug c++/92986] ODR violation not detected

2019-12-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92986 --- Comment #6 from Andrew Pinski --- Yes, this is a vague linkage function so as jakub mentioned, comparing the ir even between optimization levels is hard. Yes we could in theory it could be done but for gcc, it would mean ripping up most of t

[Bug c++/92986] ODR violation not detected

2019-12-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92986 --- Comment #5 from Jakub Jelinek --- Yes, you haven't read my comment which explained what -Wodr does and doesn't and why.

[Bug c++/92986] ODR violation not detected

2019-12-18 Thread geeteshmore at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92986 --- Comment #4 from Geetesh More --- I tried with -flto, but I'm not seeing any warning messages: g++ -std=c++0x -g -flto -Wodr main.cpp file2.cpp Am I missing anything here?

[Bug c++/92986] ODR violation not detected

2019-12-18 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92986 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c++/92986] ODR violation not detected

2019-12-18 Thread geeteshmore at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92986 --- Comment #2 from Geetesh More --- But compiler should be throwing some message/warning about declaration of same class in multiple files. This is common scenario in cases where a class is copied in multiple files.

[Bug c++/92986] ODR violation not detected

2019-12-18 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92986 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #1