Skip to content
This repository was archived by the owner on Jun 20, 2019. It is now read-only.

Commit 3eb4e67

Browse files
authored
Merge pull request #579 from ibuclaw/bug282
Fix Bug 282: internal compiler error: in chainon, at tree.c:2865
2 parents ae7507b + 60eb061 commit 3eb4e67

File tree

3 files changed

+53
-1
lines changed

3 files changed

+53
-1
lines changed

gcc/d/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-12-10 Iain Buclaw <ibuclaw@gdcproject.org>
2+
3+
* types.cc (TypeVisitor::visit(TypeClass)): Check for duplicate
4+
declarations before adding method.
5+
16
2017-12-09 Iain Buclaw <ibuclaw@gdcproject.org>
27

38
* expr.cc (ExprVisitor::visit(AddrExp)): Build internal struct literal

gcc/d/types.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,8 @@ class TypeVisitor : public Visitor
941941
FuncDeclaration *fd = t->sym->vtbl[i]->isFuncDeclaration ();
942942
tree method = fd ? get_symbol_decl (fd) : NULL_TREE;
943943

944-
if (method && DECL_CONTEXT (method) == basetype)
944+
if (method && DECL_CONTEXT (method) == basetype
945+
&& !chain_member (method, TYPE_FIELDS (basetype)))
945946
TYPE_FIELDS (basetype) = chainon (TYPE_FIELDS (basetype), method);
946947
}
947948

gcc/testsuite/gdc.dg/gdc282.d

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Bug 282
2+
3+
class C282a
4+
{
5+
void fun()
6+
{
7+
}
8+
9+
void f282()
10+
{
11+
}
12+
13+
void f282() // { dg-error "conflicts with gdc282.C282a.f282" }
14+
{
15+
}
16+
}
17+
18+
class C282b
19+
{
20+
struct S282b
21+
{
22+
}
23+
24+
void f282()
25+
{
26+
}
27+
28+
void f282() // { dg-error "conflicts with gdc282.C282b.f282" }
29+
{
30+
}
31+
}
32+
33+
class C282c
34+
{
35+
class C282c
36+
{
37+
}
38+
39+
void f282()
40+
{
41+
}
42+
43+
void f282() // { dg-error "conflicts with gdc282.C282c.f282" }
44+
{
45+
}
46+
}

0 commit comments

Comments
 (0)