Bug 52186 - A C++ template bug.
A C++ template bug.
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
8.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-08-21 11:21 EDT by hjl
Modified: 2007-04-18 12:36 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2004-10-01 19:46:13 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)
A testcase (389 bytes, patch)
2001-08-21 11:22 EDT, hjl
no flags Details | Diff
A patch (459 bytes, patch)
2001-08-21 20:56 EDT, hjl
no flags Details | Diff
A new patch (612 bytes, patch)
2001-08-22 08:50 EDT, hjl
no flags Details | Diff
A testcase (192 bytes, patch)
2001-08-23 16:38 EDT, hjl
no flags Details | Diff
A new testcase (192 bytes, patch)
2001-08-23 16:39 EDT, hjl
no flags Details | Diff
Another testcase (640 bytes, patch)
2001-08-23 20:04 EDT, hjl
no flags Details | Diff
A new patch (647 bytes, patch)
2001-08-24 03:16 EDT, hjl
no flags Details | Diff
A new patch (1.85 KB, patch)
2001-08-24 16:14 EDT, hjl
no flags Details | Diff
Another testcase (897 bytes, patch)
2001-08-25 18:55 EDT, hjl
no flags Details | Diff
A new patch (2.05 KB, patch)
2001-08-27 01:35 EDT, hjl
no flags Details | Diff

  None (edit)
Description hjl 2001-08-21 11:21:19 EDT
# gcc -c template.cc
template.cc: In method `a<A>::a ()':
template.cc:15: parse error before `>'
template.cc: In method `void a<A>::foo ()':
template.cc:21: parse error before `>'
Comment 1 hjl 2001-08-21 11:22:01 EDT
Created attachment 28715 [details]
A testcase
Comment 2 hjl 2001-08-21 11:22:33 EDT
gcc 3.1 still fails to compile it.
Comment 3 hjl 2001-08-21 20:56:18 EDT
Created attachment 28814 [details]
A patch
Comment 4 hjl 2001-08-21 20:57:19 EDT
I am enclosing a patch. It seems to work for the testcase. But I have
NO idea if it is correct at all.
Comment 5 hjl 2001-08-22 08:50:15 EDT
Created attachment 28895 [details]
A new patch
Comment 6 hjl 2001-08-22 08:52:19 EDT
I bootstrapped gcc 2.96 without regression.
Comment 7 Jakub Jelinek 2001-08-22 08:56:43 EDT
Can you please mail this to gcc-patches yourself?
I don't think I have to act as an interface between you and Jason/Mark
and this is a gcc 3.x bug. Once some patch is agreed on, I'll of course put
it in.
Comment 9 Jakub Jelinek 2001-08-23 16:31:50 EDT
But you haven't mention that the bug is present in 3.0 and 3.1 too.
Comment 10 hjl 2001-08-23 16:38:44 EDT
Created attachment 29275 [details]
A testcase
Comment 11 hjl 2001-08-23 16:39:22 EDT
Created attachment 29276 [details]
A new testcase
Comment 12 hjl 2001-08-23 16:41:00 EDT
It is a very strange bug. My last patch is not complete/correct.

# diff -up 1.cc 2.cc
--- 1.cc        Thu Aug 23 13:45:48 2001
+++ 2.cc        Thu Aug 23 13:45:30 2001
@@ -15,7 +15,7 @@ struct a
        }
 
        template<typename T>
-       void get() {
+       void set() {
        }
 };
# gcc 1.cc 2.cc -c
2.cc: In method `a<A>::a ()':
2.cc:14: parse error before `>'



Comment 13 hjl 2001-08-23 20:04:00 EDT
Created attachment 29298 [details]
Another testcase
Comment 14 hjl 2001-08-23 20:05:41 EDT
My patch doesn't help much in this new testcase.

# gcc -c 3.cc
3.cc: In method `void a<A>::a1 ()':
3.cc:33: parse error before `>'
3.cc: In method `void a<A>::a2 ()':
3.cc:40: parse error before `>'
3.cc: In method `void a<A>::a3 ()':
3.cc:47: parse error before `>'
3.cc: In method `void a<A>::a4 ()':
3.cc:54: parse error before `>'
3.cc: In method `void a<A>::a5 ()':
3.cc:61: parse error before `>'
3.cc: In method `void a<A>::a6 ()':
3.cc:68: parse error before `>'
3.cc: In method `void a<A>::a7 ()':
3.cc:76: parse error before `>'
3.cc: In method `void a<A>::a8 ()':
3.cc:84: parse error before `>'
Comment 15 hjl 2001-08-24 03:16:55 EDT
Created attachment 29346 [details]
A new patch
Comment 16 hjl 2001-08-24 03:20:34 EDT
Here is a new patch. It seems to work
with 3.cc. BTW, I am not sure if the
gcc people think it is a real problem
since I got zero response from the gcc
mailing list.
Comment 17 hjl 2001-08-24 03:22:49 EDT
My patch is not correct. I just hope it
leads to a real fix.
Comment 18 hjl 2001-08-24 16:14:46 EDT
Created attachment 29417 [details]
A new patch
Comment 19 hjl 2001-08-24 16:15:29 EDT
My new patch seems to work and causes no
regressions in gcc 2.96.
Comment 20 hjl 2001-08-25 18:55:06 EDT
Created attachment 29614 [details]
Another testcase
Comment 21 hjl 2001-08-25 18:56:03 EDT
I uploaded another testcase. I am
testing a new patch now.
Comment 22 hjl 2001-08-27 01:35:57 EDT
Created attachment 29674 [details]
A new patch
Comment 23 Richard Henderson 2004-10-01 19:46:13 EDT
Fails through gcc 3.2; fixed in gcc 3.3.

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