Bug 134633 - template specialization and namespaces
Summary: template specialization and namespaces
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 3
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-10-05 09:44 UTC by Cyril Poupon
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2004-10-05 16:58:00 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
testcase (156 bytes, text/plain)
2004-10-05 09:46 UTC, Cyril Poupon
no flags Details

Description Cyril Poupon 2004-10-05 09:44:45 UTC
Description of problem: 
 
The following code compiles with gcc-3.4.1-2 from fc3test1. It 
doesn't compile with gcc-3.4.1-10 from fc3test2. It doesn't compile 
either with a vanilla gcc 3.4.2 built from sources. I believe a bad 
patch has been integrated from gcc 3.4.2 into your copy of gcc 3.4.1. 
 
$ cat > foo.cc 
namespace nmr { 
template <class T> void helper(); 
} 
template <class T> void nmr::helper() { 
} 
template <> void nmr::helper<char>() { 
} 
$  
$ g++ -c foo.cc 
foo.cc:7: error: specialization of `template<class T> void 
nmr::helper()' in different namespace 
foo.cc:5: error:   from definition of `template<class T> void 
nmr::helper()' 
$  
 
Version-Release number of selected component (if applicable): 
gcc-c++-3.4.1-10 
 
How reproducible: 
Always 
 
Steps to Reproduce: 
1. Get attached C++ source foo.cc 
2. g++ -c foo.cc 
   
Actual results: 
Compilation fails. 
 
Expected results: 
Compilation succeeds.

Comment 1 Cyril Poupon 2004-10-05 09:46:48 UTC
Created attachment 104772 [details]
testcase

Comment 2 Cyril Poupon 2004-10-05 12:24:46 UTC
Mmmh... It looks like the Comeau compiler agrees with gcc-3.4.1-10, 
so I guess this may be one of these C++ subtleties again, not a gcc 
bug. 
 
I'm not sure which paragraph of the C++ standard this error message 
corresponds to. 
 
Note that gcc35-3.5.0-0.3 from fc3test1 does compile the code. So it 
could be a gcc 3.5.0 regression instead of gcc 3.4.1 bug. 
 

Comment 3 Jakub Jelinek 2004-10-05 12:28:41 UTC
But gcc4-4.0.0-0.2 agrees with gcc-3.4.1-10.

Comment 4 Cyril Poupon 2004-10-05 13:55:05 UTC
Ah OK, this seems to confirm this is not a spurious error message, 
but the result of the stricter application of the standard. 
 
However I understand fc3 will ship with gcc-3.4.1 and gcc35-3.5.0, 
not with gcc4-4.0.0. At least I can't find that package in the 
fc3test2 distribution. Isn't it a problem if there's a regression in 
gcc35-3.5.0? 
 
I'm just nitpicking... As far as I'm concerned, I don't intend to use 
gcc 3.5 on Fedora before it's the "native" compiler of Fedora. 
 

Comment 5 Cyril Poupon 2004-10-05 14:11:14 UTC
I've now tried gcc35-3.5.0-0.9 from fc3test2. It also exits with an 
error, unlike gcc35-3.5.0-0.3 from fc3test1, and like gcc-3.4.1-10. 
 
So this definitely looks like stricter application of the standard. I 
still don't know which paragraph of the standard, but anyway... Sorry 
for the noise. 
 

Comment 6 Jakub Jelinek 2004-10-05 16:58:00 UTC
FC3 is going to use gcc4-4.0.0-0.*.


Note You need to log in before you can comment on or make changes to this bug.