Bug 67336 - gcc segfaults on sizeof( namespace::templateClassWithoutType )
Summary: gcc segfaults on sizeof( namespace::templateClassWithoutType )
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
(Show other bugs)
Version: 8.0
Hardware: i686 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2002-06-22 21:48 UTC by Aaron Cameron
Modified: 2007-04-18 16:43 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-02 21:30:31 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Aaron Cameron 2002-06-22 21:48:14 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.5 (X11; Linux i686; U;) Gecko/20020606

Description of problem:
G++ crashes while compiling code that tries to take the sizeof() a template
class defined in a seperate namespace if that template class hasn't been given a
proper type.  This shouldn't compile anyway, but it shouldn't segfault the
compiler either.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Simply compiling the following example code:

namespace anywhere {
        template <class T_test_t>
        class cTestClass{};
void main() { sizeof(anywhere::cTestClass); }

Actual Results:  Compiler Segmentation faults instead of erroring:

gccCrash.C: In function `int main ()':
gccCrash.C:15: Internal error: Segmentation fault.
Please submit a full bug report.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.

Expected Results:  Compiler should error as it does when the template isn't in
its own namespace:

gccCrash.C: In function `int main ()':
gccCrash.C:15: use of class template `template <T_test_t> class 
cTestClass' as expression

Additional info:

Always happens with: gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)
I don't have the resources to test other versions.

Comment 1 Alan Cox 2002-12-15 21:44:11 UTC
Still present in 8.0 (though g++ 3.2 cares that you have int main() not void
and so initially it seemed ok !)

Comment 2 Richard Henderson 2004-10-02 21:30:31 UTC
Fixed in gcc 3.3.

z.c: In function `int main()':
z.c:5: error: invalid use of template `template<class T_test_t> class

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