This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/3478: ICE when using enum from template class



>Number:         3478
>Category:       c++
>Synopsis:       ICE when using enum from template class
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jun 29 08:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Thornburg
>Release:        gcc version 2.95.2 19991024 (release)
>Organization:
>Environment:
bug occurs for both i586-pc-linux-gnu (Red Hat Linux release 6.2 (Zoot))
and for alphaev56-dec-osf4.0d (Digital UNIX V4.0D  (Rev. 878))
>Description:
% /usr/local/share2/bin/g++ -v -save-temps -Wall -c bad.cc
Reading specs from /usr/local/share2/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/share2/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/cpp -lang-c++ -v -D__GNU
C__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__
 -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem
(posix) -D__EXCEPTIONS -Wall -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i38
6__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__ bad.cc bad.ii
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/share2/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/../../../../include/g++-
3
 /usr/local/include
 /usr/local/share2/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/../../../../i586-pc-linu
x-gnu/include
 /usr/local/share2/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/local/share2/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/cc1plus bad.ii -quiet -d
umpbase bad.cc -Wall -version -o bad.s
GNU C++ version 2.95.2 19991024 (release) (i586-pc-linux-gnu) compiled by GNU C 
version 2.95.2 19991024 (release).
bad.cc: In function `void bar(int)':
bad.cc:15: warning: unused variable `const enum linear_map<double>::noninteger_a
ction floor_or_round'
bad.cc: In function `void foo()':
bad.cc:22: Internal compiler error.
bad.cc:22: Please submit a full bug report.
bad.cc:22: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for inst
ructions.
%
>How-To-Repeat:
Compiling the following C++ program causes an ICE,
reported at the line (22) in foo() containing the assignment.

// bad.cc -- tickle gcc bug

inline int is_even(int i) { return !(i & 0x1); }

template <typename fpt>
class   linear_map
        {
public:
        enum noninteger_action { error, warning, round, floor, ceiling };
        };

void bar(int N_interp)
{
const enum linear_map<double>::noninteger_action floor_or_round
        = is_even(N_interp) ? linear_map<double>::floor
                            : linear_map<double>::round;
}

template <typename fpt> void foo()
{
const enum linear_map<fpt>::noninteger_action floor_or_round
        = is_even(N_interp) ? linear_map<fpt>::floor
                            : linear_map<fpt>::round;
}
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bad.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bad.cc"

Ly8gYmFkLmNjIC0tIHRpY2tsZSBnY2MgYnVnCgppbmxpbmUgaW50IGlzX2V2ZW4oaW50IGkpIHsg
cmV0dXJuICEoaSAmIDB4MSk7IH0KCnRlbXBsYXRlIDx0eXBlbmFtZSBmcHQ+CmNsYXNzCWxpbmVh
cl9tYXAKCXsKcHVibGljOgoJZW51bSBub25pbnRlZ2VyX2FjdGlvbiB7IGVycm9yLCB3YXJuaW5n
LCByb3VuZCwgZmxvb3IsIGNlaWxpbmcgfTsKCX07Cgp2b2lkIGJhcihpbnQgTl9pbnRlcnApCnsK
Y29uc3QgZW51bSBsaW5lYXJfbWFwPGRvdWJsZT46Om5vbmludGVnZXJfYWN0aW9uIGZsb29yX29y
X3JvdW5kCgk9IGlzX2V2ZW4oTl9pbnRlcnApID8gbGluZWFyX21hcDxkb3VibGU+OjpmbG9vcgoJ
CQkgICAgOiBsaW5lYXJfbWFwPGRvdWJsZT46OnJvdW5kOwp9Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUg
ZnB0PiB2b2lkIGZvbygpCnsKY29uc3QgZW51bSBsaW5lYXJfbWFwPGZwdD46Om5vbmludGVnZXJf
YWN0aW9uIGZsb29yX29yX3JvdW5kCgk9IGlzX2V2ZW4oTl9pbnRlcnApID8gbGluZWFyX21hcDxm
cHQ+OjpmbG9vcgoJCQkgICAgOiBsaW5lYXJfbWFwPGZwdD46OnJvdW5kOwp9Cg==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]