This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17530] New: 4.0: failure to emit inline function



When the source below is compiled, gcc emits a reference to the
inline function `B::staticfunc' but not the definition:

$ ./cc1plus  -quiet x.cc
$ grep staticfunc x.s
        pushl   $_ZN1B10staticfuncEv
$

For this example, this happens only when optimization is off; when
optimization is on, everything gets completely inlined and the problem
disappears.  However, in the original source from which this example
was derived, the problem was observed even with optimization on.

Environment:
System: Linux karma 2.6.8.1 #20 Mon Sep 13 23:48:47 EDT 2004 i686 i686 i386 GNU/Linux
Architecture: i686

	<machine, os, target, libraries (multiple lines)>
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: /home/sss/gcc/gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f95

How-To-Repeat:

Compile the source below:

------------------------------------
typedef void (*Func) ();

struct A
{
  A (Func) {}
};

struct B
{
  static void staticfunc () {}
};

template <class T>
struct C
{
  C() : a (B::staticfunc) {}
  A a;
};

int main ()
{
  C<int> c;
  return 0;
}
------------------------------------
------- Additional Comments From snyder at fnal dot gov  2004-09-17 02:39 -------
Fix:
	<how to correct or work around the problem, if known (multiple lines)>

-- 
           Summary: 4.0: failure to emit inline function
           Product: gcc
           Version: 0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: snyder at fnal dot gov
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]