https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
Eric Gallager changed:
What|Removed |Added
CC||egallager at gcc dot gnu.org
---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
--- Comment #6 from Norman Goldstein ---
Thank you for that. I hadn't realized there was a -flto flag. It, indeed,
does warn for the mismatched types. The flag also causes the notice
note: code may be misoptimized unless
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
--- Comment #5 from Jonathan Wakely ---
(In reply to Norman Goldstein from comment #4)
> This makes sense. Would it be a reasonable option to have the linker check
> for such mismatches?
As Andrew already said, it can only be done with LTO,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
--- Comment #4 from Norman Goldstein ---
I've received an explanation from bug-gnu-ut...@gnu.org. The C++11 standard
3.5/10 states that "... the types specified by all declarations referring to a
given variable or function shall be identical
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
--- Comment #3 from Norman Goldstein ---
The 2nd reference
https://en.cppreference.com/w/cpp/language/definition
differentiates between a bare "extern" statement, and an initializing extern
statement. The former is a declaration, but not a
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
--- Comment #2 from Jonathan Wakely ---
(In reply to Norman Goldstein from comment #0)
> The type of "foo" is different in the two files:
Yes, you've violated the C++ One-Definition Rule, which means your program is
ill-formed, but the
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93585
Andrew Pinski changed:
What|Removed |Added
Status|UNCONFIRMED |RESOLVED
Resolution|---