public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58738] New: forward declaration of function inside function cause link problem with optimization
@ 2013-10-15 12:38 dushistov at mail dot ru
  2013-10-15 13:09 ` [Bug c++/58738] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dushistov at mail dot ru @ 2013-10-15 12:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58738
           Summary: forward declaration of function inside function cause
                    link problem with optimization
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dushistov at mail dot ru

Here source code of test case:
namespace {

int foo()
{
    int bar(void);
    return bar();
}

int bar() { return -1; }

}

int main(int argc, char* argv[])
{
    return foo();
}

With g++ -O0 -Wpedantic -ansi -Wall test.cpp it compiles fine, while
with the same options except s/-O0/-O2/g it gave:
undefined reference to `(anonymous namespace)::bar()'.

gcc 4.8.1/amd64


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-10  0:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-15 12:38 [Bug c++/58738] New: forward declaration of function inside function cause link problem with optimization dushistov at mail dot ru
2013-10-15 13:09 ` [Bug c++/58738] " redi at gcc dot gnu.org
2013-10-15 14:07 ` dushistov at mail dot ru
2021-09-10  0:00 ` pinskia at gcc dot gnu.org
2021-09-10  0:04 ` pinskia at gcc dot gnu.org

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).