Bug 134633 - template specialization and namespaces
template specialization and namespaces
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
3
All Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-05 05:44 EDT by Cyril Poupon
Modified: 2007-11-30 17:10 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-05 12:58:00 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Cyril Poupon 2004-10-05 05:44:45 EDT
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 05:46:48 EDT
Created attachment 104772 [details]
testcase
Comment 2 Cyril Poupon 2004-10-05 08:24:46 EDT
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 08:28:41 EDT
But gcc4-4.0.0-0.2 agrees with gcc-3.4.1-10.
Comment 4 Cyril Poupon 2004-10-05 09:55:05 EDT
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 10:11:14 EDT
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 12:58:00 EDT
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.