Bug 52186 - A C++ template bug.
Summary: A C++ template bug.
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 8.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-08-21 15:21 UTC by hjl
Modified: 2007-04-18 16:36 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2004-10-01 23:46:13 UTC


Attachments (Terms of Use)
A testcase (389 bytes, patch)
2001-08-21 15:22 UTC, hjl
no flags Details | Diff
A patch (459 bytes, patch)
2001-08-22 00:56 UTC, hjl
no flags Details | Diff
A new patch (612 bytes, patch)
2001-08-22 12:50 UTC, hjl
no flags Details | Diff
A testcase (192 bytes, patch)
2001-08-23 20:38 UTC, hjl
no flags Details | Diff
A new testcase (192 bytes, patch)
2001-08-23 20:39 UTC, hjl
no flags Details | Diff
Another testcase (640 bytes, patch)
2001-08-24 00:04 UTC, hjl
no flags Details | Diff
A new patch (647 bytes, patch)
2001-08-24 07:16 UTC, hjl
no flags Details | Diff
A new patch (1.85 KB, patch)
2001-08-24 20:14 UTC, hjl
no flags Details | Diff
Another testcase (897 bytes, patch)
2001-08-25 22:55 UTC, hjl
no flags Details | Diff
A new patch (2.05 KB, patch)
2001-08-27 05:35 UTC, hjl
no flags Details | Diff

Description hjl 2001-08-21 15:21:19 UTC
# 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 15:22:01 UTC
Created attachment 28715 [details]
A testcase

Comment 2 hjl 2001-08-21 15:22:33 UTC
gcc 3.1 still fails to compile it.

Comment 3 hjl 2001-08-22 00:56:18 UTC
Created attachment 28814 [details]
A patch

Comment 4 hjl 2001-08-22 00:57:19 UTC
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 12:50:15 UTC
Created attachment 28895 [details]
A new patch

Comment 6 hjl 2001-08-22 12:52:19 UTC
I bootstrapped gcc 2.96 without regression.

Comment 7 Jakub Jelinek 2001-08-22 12:56:43 UTC
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 20:31:50 UTC
But you haven't mention that the bug is present in 3.0 and 3.1 too.

Comment 10 hjl 2001-08-23 20:38:44 UTC
Created attachment 29275 [details]
A testcase

Comment 11 hjl 2001-08-23 20:39:22 UTC
Created attachment 29276 [details]
A new testcase

Comment 12 hjl 2001-08-23 20:41:00 UTC
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-24 00:04:00 UTC
Created attachment 29298 [details]
Another testcase

Comment 14 hjl 2001-08-24 00:05:41 UTC
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 07:16:55 UTC
Created attachment 29346 [details]
A new patch

Comment 16 hjl 2001-08-24 07:20:34 UTC
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 07:22:49 UTC
My patch is not correct. I just hope it
leads to a real fix.

Comment 18 hjl 2001-08-24 20:14:46 UTC
Created attachment 29417 [details]
A new patch

Comment 19 hjl 2001-08-24 20:15:29 UTC
My new patch seems to work and causes no
regressions in gcc 2.96.

Comment 20 hjl 2001-08-25 22:55:06 UTC
Created attachment 29614 [details]
Another testcase

Comment 21 hjl 2001-08-25 22:56:03 UTC
I uploaded another testcase. I am
testing a new patch now.

Comment 22 hjl 2001-08-27 05:35:57 UTC
Created attachment 29674 [details]
A new patch

Comment 23 Richard Henderson 2004-10-01 23:46:13 UTC
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.