public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27070]  New: Different  partial template specialization result with different  optimization options?
@ 2006-04-07  2:26 meter dot ten at gmail dot com
  2006-04-07  2:37 ` [Bug c++/27070] " meter dot ten at gmail dot com
  0 siblings, 1 reply; 2+ messages in thread
From: meter dot ten at gmail dot com @ 2006-04-07  2:26 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

gcc version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
gcc version 4.0.3 (Ubuntu 4.0.3-1ubuntu3)

Different  partial template specialization result with different  optimization
options?

1. right result without optimization 
$g++ -O0 -g3 -c test.cpp
$g++ -O0 -g3 -c a.cpp
$g++ -O0 -g3 -o test test.o a.o
$./test
DEFAULT
PARTIAL

2. wrong  result with  optimization 
$g++ -O2 -g0 -c test.cpp
$g++ -O2 -g0 -c a.cpp
$g++ -O2 -g0 -o test test.o a.o
$./test
DEFAULT
DEFAULT
????Bug???

3.if write three part in one file ,we get the right result
$g++ -O2 -g0 -o test2  test2
$./test2
DEFAULT
PARTIAL

$g++ -O0 -g3 -o test2  test2
$./test2
DEFAULT
PARTIAL






//************
//a.h
//************

#ifndef A_H
#define A_H

#include
using namespace std;
template
class A
{
public:
void echo() {cout << "ĬÈÏ" << endl;}
}
;
#endif

//************
//a.cpp
//************
#include "a.h"
template <>
void
A<0>::echo()
{
cout << "ÌØ»¯" << endl;
}

//************
//test.cpp
//************
#include "a.h"
int main( int argc, char *argv[] )
{
A<1>  DEFAULT;
A<0>  PARTICULAR;
DEFAULT.echo();
PARTICULAR.echo();

return EXIT_SUCCESS;
}

//************
//test2.cpp
//************

#include
using namespace std;
template
class A
{
public:
void echo() {cout << "ĬÈÏ" << endl;}
}
;
template <>
void
A<0>::echo()
{
cout << "ÌØ»¯" << endl;
}

int main( int argc, char *argv[] )
{
A<1> DEFAULT;
A<0> PARTICULAR;
DEFAULT.echo();
PARTICULAR.echo();

return EXIT_SUCCESS;
}


-- 
           Summary: Different  partial template specialization result with
                    different  optimization options?
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: meter dot ten at gmail dot com


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


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

* [Bug c++/27070] Different  partial template specialization result with different  optimization options?
  2006-04-07  2:26 [Bug c++/27070] New: Different partial template specialization result with different optimization options? meter dot ten at gmail dot com
@ 2006-04-07  2:37 ` meter dot ten at gmail dot com
  0 siblings, 0 replies; 2+ messages in thread
From: meter dot ten at gmail dot com @ 2006-04-07  2:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from meter dot ten at gmail dot com  2006-04-07 02:37 -------
this is not a bug.


-- 

meter dot ten at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2006-04-07  2:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-07  2:26 [Bug c++/27070] New: Different partial template specialization result with different optimization options? meter dot ten at gmail dot com
2006-04-07  2:37 ` [Bug c++/27070] " meter dot ten at gmail dot com

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