public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18512] New: ICE on overriden template method
@ 2004-11-16 2:13 Tringi at Mx-3 dot cz
2004-11-16 2:21 ` [Bug c++/18512] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Tringi at Mx-3 dot cz @ 2004-11-16 2:13 UTC (permalink / raw)
To: gcc-bugs
Hello,
I was just wondering around code and following code resulted in ICE (MinGW
3.4.2). I don't think that this is some kind of terrible bug as the code is
obviously wrong (or isn't it?). Maybe you'll want to know about it, at least
the compiler want me to report bug :) Maybe someone already reported
it ...unfortunately have no time to browse buglists... :(
The error message is:
g++.exe -c main.cpp -o main.o -I"C:/Code/Dev-Cpp/include"
-I"C:/Code/Dev-Cpp/include/c++/3.4.2"
-I"C:/Code/Dev-Cpp/include/c++/3.4.2/backward"
-I"C:/Code/Dev-Cpp/include/c++/3.4.2/mingw32"
-I"C:/Code/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -save-temps -Wall
main.cpp: In member function `virtual const int iii::get_callback() const':
main.cpp:13: internal compiler error: in lookup_member, at cp/search.c:1288
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.mingw.org/bugs.shtml> for instructions.make.exe: ***
[main.o] Error 1
Yes I know it says to contact MinGW but I think the ICEs are better to submit
to GCC directly, aren't they?
The codes are:
--- main.cpp ---
#include <stdlib.h>
#include <stdio.h>
#include "cProperty.tcc"
class iii : public property<int> {
public:
iii() { };
iii(int i) : property<int>(i) { };
protected:
const int get_callback() const {
printf("my getcb\n");
return this->property<int>; // this causes the ICE
};
};
int main(int argc, char *argv[]) {
iii *i = new iii;
printf("::: %d\n", (int)*i );
*i = 1;
printf("::: %d\n", (int)*i );
delete i;
system("PAUSE");
return 0;
};
--- EOF ---
--- cProperty.tcc ---
#ifndef CPROPERTY_HPP
#define CPROPERTY_HPP
template <typename T> class property {
private:
T _p;
protected:
virtual const T get_callback() const { printf("getcb\n"); return _p; };
virtual const T set_callback(const T& p) const { printf("setcb\n");
return
p; };
public:
property() { };
property(const T &p) { this->_p = set_callback(p); };
virtual ~property() { };
virtual operator T() const { return get_callback(); };
virtual const T& operator=(const T &p) { return this->_p = set_callback
(p);
};
};
#endif
--- EOF ---
Well, there is a lot of code that could be stripped but I hope you can browse
through it.
Have a good time.
--
Summary: ICE on overriden template method
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Tringi at Mx-3 dot cz
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4/4.0 Regression] ICE on overriden template method
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
@ 2004-11-16 2:21 ` pinskia at gcc dot gnu dot org
2004-11-16 2:35 ` [Bug c++/18512] [3.4/4.0 Regression] ICE on invalid usage of template base class reichelt at gcc dot gnu dot org
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-16 2:21 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-11-16 02:21 -------
Confirmed.
: Search converges between 2003-07-08-trunk (#288) and 2003-07-09-trunk (#289).
reduced testcase:
template <typename T> struct property {
};
struct iii : public property<int> {
const int get_callback() const {
return this->property<int>;
};
};
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Keywords| |ice-on-valid-code
Last reconfirmed|0000-00-00 00:00:00 |2004-11-16 02:21:16
date| |
Summary|ICE on overriden template |[3.4/4.0 Regression] ICE on
|method |overriden template method
Target Milestone|--- |3.4.4
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4/4.0 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
2004-11-16 2:21 ` [Bug c++/18512] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2004-11-16 2:35 ` reichelt at gcc dot gnu dot org
2004-11-27 17:29 ` mmitchel at gcc dot gnu dot org
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-16 2:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2004-11-16 02:35 -------
More compact testcase:
==================================
template<int> struct A {};
struct B : A<0>
{
void foo() { this->A<0>; }
};
==================================
This is really invalid code.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
Keywords|ice-on-valid-code |ice-on-invalid-code,
| |monitored
Summary|[3.4/4.0 Regression] ICE on |[3.4/4.0 Regression] ICE on
|overriden template method |invalid usage of template
| |base class
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4/4.0 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
2004-11-16 2:21 ` [Bug c++/18512] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-16 2:35 ` [Bug c++/18512] [3.4/4.0 Regression] ICE on invalid usage of template base class reichelt at gcc dot gnu dot org
@ 2004-11-27 17:29 ` mmitchel at gcc dot gnu dot org
2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-27 17:29 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
|dot org |
Status|NEW |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4/4.0 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
` (2 preceding siblings ...)
2004-11-27 17:29 ` mmitchel at gcc dot gnu dot org
@ 2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
2004-11-29 20:25 ` [Bug c++/18512] [3.4 " mmitchel at gcc dot gnu dot org
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-29 20:11 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2004-11-29 20:10 -------
Subject: Bug 18512
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: mmitchel@gcc.gnu.org 2004-11-29 20:10:18
Modified files:
gcc/testsuite : ChangeLog
gcc/cp : ChangeLog cp-tree.def cp-tree.h decl.c error.c
friend.c parser.c pt.c
gcc/testsuite/g++.old-deja/g++.brendan: crash16.C
gcc/testsuite/g++.old-deja/g++.law: ctors5.C
gcc/testsuite/g++.old-deja/g++.other: crash25.C
Added files:
gcc/testsuite/g++.dg/template: error16.C crash29.C
Log message:
PR c++/18368
* parser.c (cp_parser_check_for_definition_in_return_type): Take
the defined type as a parameter, and inform the user about the
possibility of a missing semicolon.
(cp_parser_explicit_instantiation): Adjust call to
cp_parser_check_for_definition_in_return_type.
(cp_parser_init_declarator): Likewise.
(cp_parser_member_declaration): Likewise.
PR c++/18674
* cp-tree.def (TYPENAME_TYPE): Remove discussion of implicit
typename from comments.
* cp-tree.h (TYPENAME_IS_ENUM_P): New macro.
(TYPENAME_IS_CLASS_P): Likewise.
(make_typename_type): Change prototype.
* decl.c (struct_typename_info): New type.
(typename_compare): Expect the second argument to be a
typename_info, not a tree.
(build_typename_type): Add tag_type parameter. Do not create a
new type until necessary.
(make_typename_type): Add tag_type parameter.
* error.c (TYPENAME_TYPE): Print tags other than "typename" if
appropriate.
* friend.c (make_friend_class): Adjust call to make_typename_type.
* parser.c (cp_parser_make_typename_type): Likewise.
(cp_parser_primary_expression): Adjust call to
cp_parser_lookup_name.
(cp_parser_unqualified_id): Adjust calls to cp_parser_class_name.
(cp_parser_class_or_namespace_name): Likewise.
(cp_parser_postfix_expression): Adjust calls to
make_typename_type.
(cp_parser_mem_initializer_id): Adjust calls to
cp_parser_class_name.
(cp_parser_type_parameter): Adjust calls to cp_parser_lookup_name.
(cp_parser_template_name): Likewise.
(cp_parser_template_argument): Likewise.
(cp_parser_type_name): Adjust call to cp_parser_class_name.
(cp_parser_elaborated_type_specifier): Adjust calls to
make_typename_type and cp_parser_lookup_name.
(cp_parser_namespace_name): Likewise.
(cp_parser_class_name): Replace type_p parameter with tag_type.
Adjust calls to make_typename_type and cp_parser_lookup_name.
(cp_parser_class_head): Adjust calls to cp_parser_class_name.
(cp_parser_base_specifier): Likewise.
(cp_parser_lookup_name): Replace is_type parameter with tag_type.
Adjust calls to make_typename_type and lookup_qualified_name.
(cp_parser_lookup_name_simple): Adjust call to
cp_parser_lookup_name.
(cp_parser_constructor_declarator_p): Adjust call to
cp_parser_class_name.
* pt.c (convert_template_argument): Adjust all to
make_typename_type.
(tsubst_decl): Do not pre-substitute the type of the declaration.
(tsubst): Hand off declarations more quickly. Adjust call to
make_typename_type.
PR c++/18512
* parser.c (cp_parser_postfix_dot_deref_expression): Robustify.
PR c++/18674
* g++.old-deja/g++.brendan/crash16.C: Adjust error messages.
* g++.old-deja/g++.law/ctors5.C: Likewise.
* g++.old-deja/g++.other/crash25.C: Likewise.
PR c++/18674
* g++.dg/template/error16.C: New test.
PR c++/18512
* g++.dg/template/crash29.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4679&r2=1.4680
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error16.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash29.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4504&r2=1.4505
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.def.diff?cvsroot=gcc&r1=1.90&r2=1.91
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1076&r2=1.1077
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1336&r2=1.1337
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/error.c.diff?cvsroot=gcc&r1=1.272&r2=1.273
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&r1=1.102&r2=1.103
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.283&r2=1.284
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.951&r2=1.952
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.brendan/crash16.C.diff?cvsroot=gcc&r1=1.5&r2=1.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.law/ctors5.C.diff?cvsroot=gcc&r1=1.5&r2=1.6
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.old-deja/g++.other/crash25.C.diff?cvsroot=gcc&r1=1.6&r2=1.7
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
` (3 preceding siblings ...)
2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-29 20:25 ` mmitchel at gcc dot gnu dot org
2005-04-22 4:13 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-11-29 20:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2004-11-29 20:25 -------
Fixed in 4.0.
--
What |Removed |Added
----------------------------------------------------------------------------
Summary|[3.4/4.0 Regression] ICE on |[3.4 Regression] ICE on
|invalid usage of template |invalid usage of template
|base class |base class
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
` (4 preceding siblings ...)
2004-11-29 20:25 ` [Bug c++/18512] [3.4 " mmitchel at gcc dot gnu dot org
@ 2005-04-22 4:13 ` pinskia at gcc dot gnu dot org
2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-22 4:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-22 04:11 -------
*** Bug 21157 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |leslie dot barnes at amd dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
` (5 preceding siblings ...)
2005-04-22 4:13 ` pinskia at gcc dot gnu dot org
@ 2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
2005-09-01 14:58 ` reichelt at gcc dot gnu dot org
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-05-19 17:25 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|3.4.4 |3.4.5
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
` (6 preceding siblings ...)
2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
@ 2005-09-01 14:58 ` reichelt at gcc dot gnu dot org
2005-09-01 15:23 ` cvs-commit at gcc dot gnu dot org
2005-09-01 15:24 ` reichelt at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-09-01 14:58 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-09-01 14:58 -------
Taking care of the backport to the 3.4 branch.
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|mark at codesourcery dot com|reichelt at gcc dot gnu dot
| |org
URL| |http://gcc.gnu.org/ml/gcc-
| |patches/2005-
| |09/msg00036.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
` (7 preceding siblings ...)
2005-09-01 14:58 ` reichelt at gcc dot gnu dot org
@ 2005-09-01 15:23 ` cvs-commit at gcc dot gnu dot org
2005-09-01 15:24 ` reichelt at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-09-01 15:23 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-09-01 15:23 -------
Subject: Bug 18512
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-3_4-branch
Changes by: reichelt@gcc.gnu.org 2005-09-01 15:23:21
Modified files:
gcc/cp : ChangeLog parser.c
gcc/testsuite : ChangeLog
Added files:
gcc/testsuite/g++.dg/template: crash29.C
Log message:
Backport:
2004-11-27 Mark Mitchell <mark@codesourcery.com>
PR c++/18512
* parser.c (cp_parser_postfix_expression): Robustify.
* g++.dg/template/crash29.C: New test.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.234&r2=1.3892.2.235
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.60&r2=1.157.2.61
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.425&r2=1.3389.2.426
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash29.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.46.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug c++/18512] [3.4 Regression] ICE on invalid usage of template base class
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
` (8 preceding siblings ...)
2005-09-01 15:23 ` cvs-commit at gcc dot gnu dot org
@ 2005-09-01 15:24 ` reichelt at gcc dot gnu dot org
9 siblings, 0 replies; 11+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-09-01 15:24 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-09-01 15:24 -------
Fixed also on the 3.4 branch.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18512
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-09-01 15:24 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-16 2:13 [Bug c++/18512] New: ICE on overriden template method Tringi at Mx-3 dot cz
2004-11-16 2:21 ` [Bug c++/18512] [3.4/4.0 Regression] " pinskia at gcc dot gnu dot org
2004-11-16 2:35 ` [Bug c++/18512] [3.4/4.0 Regression] ICE on invalid usage of template base class reichelt at gcc dot gnu dot org
2004-11-27 17:29 ` mmitchel at gcc dot gnu dot org
2004-11-29 20:11 ` cvs-commit at gcc dot gnu dot org
2004-11-29 20:25 ` [Bug c++/18512] [3.4 " mmitchel at gcc dot gnu dot org
2005-04-22 4:13 ` pinskia at gcc dot gnu dot org
2005-05-19 17:25 ` mmitchel at gcc dot gnu dot org
2005-09-01 14:58 ` reichelt at gcc dot gnu dot org
2005-09-01 15:23 ` cvs-commit at gcc dot gnu dot org
2005-09-01 15:24 ` reichelt at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).