public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28271]  New: Specialization of a function is not called if compile with -03 option
@ 2006-07-05 13:08 maxime dot fiandino at imag dot fr
  2006-07-05 13:11 ` [Bug c++/28271] " maxime dot fiandino at imag dot fr
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: maxime dot fiandino at imag dot fr @ 2006-07-05 13:08 UTC (permalink / raw)
  To: gcc-bugs

The specialization of a function is not called if compile with -03 option,
the generic implementation is called insteed.
This appear only if the declaration of the specialization is in another
file.
The specialization is called if compiled with -02 or lees optimization, or
if the generic implementation is declared with the buildin noinline.

Configuration of gcc -v:

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../src/configure
--prefix=/project/spg/tools/Open-Sources/gcc/4.1.1/Linux-x86/
--enable-__cxa_atexit --enable-shared --enable-long-long --enable-threads
--enable-languages=c,c++ --with-gnu-as --with-gnu-ar --with-gnu-ld --with-gcc
Thread model: posix
gcc version 4.1.1


Three files:

header


#ifndef _TCLASS_H_
#define _TCLASS_H_

template<typename T> bool foo(T val)
{
return false;
}

#endif 

scpecialization:
#include "tclass.h"


template<> bool foo(int val)
{
return true;
}

main:

#include "tclass.h"

int main() {

return(foo(1));

}


-- 
           Summary: Specialization of a function is not called if compile
                    with -03 option
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: maxime dot fiandino at imag dot fr
 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=28271


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

end of thread, other threads:[~2006-07-05 14:33 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-05 13:08 [Bug c++/28271] New: Specialization of a function is not called if compile with -03 option maxime dot fiandino at imag dot fr
2006-07-05 13:11 ` [Bug c++/28271] " maxime dot fiandino at imag dot fr
2006-07-05 13:12 ` maxime dot fiandino at imag dot fr
2006-07-05 13:13 ` maxime dot fiandino at imag dot fr
2006-07-05 13:14 ` maxime dot fiandino at imag dot fr
2006-07-05 13:18 ` maxime dot fiandino at imag dot fr
2006-07-05 14:04 ` rguenth at gcc dot gnu dot org
2006-07-05 14:33 ` maxime dot fiandino at imag dot fr

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