[Bug c++/53930] bug in linker

bespalovdn at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Jul 12 10:52:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53930

--- Comment #8 from Dmitry Bespalov <bespalovdn at gmail dot com> 2012-07-12 10:51:51 UTC ---
Jonathan,

I'm not sure if we're talking about the same thing. You've asked:
<< If that was the case how would you ever use any type (e.g. std::string) in
more
<< than one file, it would be a different type in every file.

std::string is a rigid type defined in <string>, and if I refer it in some cpp
I should include the file where this type is defined, right? So I actually do
not redefine std::string again, I just the type defined in third file.

The my case is another. I define different types in different cpps. Functions
from one cpp can't reference types defined in other cpp, right? (note, I do not
use "extern" or something else). So struct A defined in file2.cpp should not
became an instance in file1.cpp. I'm not a guru in ISO standards, but this
particular case is one of basic things that knows everybody. Types defined in
one cpp should not appear as instance in another one.



More information about the Gcc-bugs mailing list