Bugzilla will be upgraded to version 5.0 on December 2, 2018. The outage period for the upgrade will start at 0:00 UTC and have a duration of 12 hours
Bug 178061 - g++ segfaults on typename
g++ segfaults on typename
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2006-01-17 12:21 EST by Ethan Tira-Thompson
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version: 3.4.5-2
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-01-17 16:41:52 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
preprocessed source for the bug (255.55 KB, application/octet-stream)
2006-01-17 13:42 EST, Ethan Tira-Thompson
no flags Details

  None (edit)
Description Ethan Tira-Thompson 2006-01-17 12:21:51 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/416.12 (KHTML, like Gecko) Safari/416.13

Description of problem:
here is the code which causes the crash:
#include <vector>

template<class PredType>
void foo() {
  bar(typename std::back_insert_iterator<std::vector<int> >(baz));
Removing the 'typename' avoids the segfault

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

How reproducible:

Steps to Reproduce:

Additional info:
Comment 1 Ethan Tira-Thompson 2006-01-17 13:42:12 EST
Created attachment 123317 [details]
preprocessed source for the bug
Comment 2 Ethan Tira-Thompson 2006-01-17 13:45:42 EST
Please note that removing the 'typename' keyword simply avoids the crash -- I
realize that the code shown will then result in a compilation error.  The key is
that it should give the error and not segfault.

If that is resolved, I expect it would successfully compile if the full code
were being compiled instead of this minimal snippet.
Comment 3 Jakub Jelinek 2006-01-17 16:41:52 EST
g++ -v; g++ 178061.ii
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.5/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk --host=i386-redhat-linux
Thread model: posix
gcc version 3.4.5 20051201 (Red Hat 3.4.5-2)
foo.cc: In function `void foo()':
foo.cc:5: error: `baz' was not declared in this scope
foo.cc:5: error: there are no arguments to `bar' that depend on a template
parameter, so a declaration of `bar' must be available
foo.cc:5: error: (if you use `-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)

I don't have FC3 gcc around to check it (FC3 support has been moved to Fedora
Legacy already), but as you can see with the latest GCC 3.4.x-RH this is not
reproducible, neither I can reproduce it with GCC 4.0.x (FC4) nor GCC 4.1.x
(rawhide).  But even latest FC3 gcc is gcc-3.4.4-2.fc3, so it is quite likely
it is fixed there too.

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