Package: g++-3.3 Version: 1:3.3.5-2 Severity: normal Here are 3 functions and a dummy main:
--begin-- int one() { return 1; } static int two() { return 2; } namespace { int three() { return 3; } } int main() { return one() + two() + three(); } --end-- i was expecting that g++ handled two() and three() the same way, that is to say generated object-code with internal linkage. But g++ doesn't. three() has external linkage, just like one(). TCPPPL says that an anonymous namespace is a namespace with a unique name. Fine. Then why g++ does not optimize this ? The previous program returns 6. g++ outputs a definition for three(), but it is obvious that two() and three() definitions are no longer needed because they've been inlined. That's why g++ doesn't output a definition for two(). In the end, i get a never-used definition of three() ... Thanks -- System Information: Debian Release: 3.1 APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: powerpc (ppc) Kernel: Linux 2.6.8-powerpc Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to fr_FR.UTF-8) Versions of packages g++-3.3 depends on: ii gcc-3.3 1:3.3.5-2 The GNU C compiler ii gcc-3.3-base 1:3.3.5-2 The GNU Compiler Collection (base ii libc6 2.3.2.ds1-18 GNU C Library: Shared libraries an ii libstdc++5-3.3-dev 1:3.3.5-2 The GNU Standard C++ Library v3 (d -- no debconf information