www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19500] New: assert(idec.type.ty != Tclass ||

https://issues.dlang.org/show_bug.cgi?id=19500

          Issue ID: 19500
           Summary: assert(idec.type.ty != Tclass ||
                    (cast(TypeClass)idec.type).sym == idec) fails
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: undefer gmail.com

Compilation of the next code fails on the latest version of dmd on assert (with
dmd compiled without (ENABLE_RELEASE=1):

struct Tup(T...)
{
    bool opEquals()     {
        foreach (i; T)
            static if (__traits(compiles, mixin("new
InputRangeObject11261!(abs_class)")))
msg;
    }
}

/**********************************************/

void test3()
{
    Tup!(int, double) ;
}

interface InputRange11261(E)
{
}
template InputRangeObject11261(R)
{
    alias typeof(init.front()) E;

    class InputRangeObject11261 : InputRange11261!E
    {
    }
}

class abs_class
{
}

The full dump of compilation output:

---
ERROR: This is a compiler bug.
Please report it via https://issues.dlang.org/enter_bug.cgi
with, preferably, a reduced, reproducible example and the information below.
DustMite (https://github.com/CyberShadow/DustMite/wiki) can help with the
reduction.
---
DMD v2.084.0-beta.1-30-gba2e27f2c
predefs   DigitalMars Posix linux ELFv1 CRuntime_Glibc CppRuntime_Gcc
LittleEndian D_Version2 all D_SIMD D_InlineAsm_X86_64 X86_64 D_LP64 D_PIC
assert D_ModuleInfo D_Exceptions D_TypeInfo D_HardFloat
binary    dmd
version   v2.084.0-beta.1-30-gba2e27f2c
config   
/mnt/raid/system/home/undefer/MyFiles/Sources/D/dmd/generated/linux/release/64/dmd.conf
DFLAGS   
-I/mnt/raid/system/home/undefer/MyFiles/Sources/D/dmd/generated/linux/release/64/../../../../../druntime/import
-I/mnt/raid/system/home/undefer/MyFiles/Sources/D/dmd/generated/linux/release/64/../../../../../phobos
-L-L/mnt/raid/system/home/undefer/MyFiles/Sources/D/dmd/generated/linux/release/64/../../../../../phobos/generated/linux/release/64
-L--export-dynamic -fPIC
---
core.exception.AssertError dmd/dsymbolsem.d(5318): Assertion failure
----------------
??:? _d_assertp [0xfbf9f6a8]
dmd/dsymbolsem.d:5318 _ZN22DsymbolSemanticVisitor5visitEP20InterfaceDeclaration
[0xfbdc0c19]
dmd/dclass.d:1129 _ZN20InterfaceDeclaration6acceptEP7Visitor [0xfbd7ad79]
dmd/dsymbolsem.d:376 _Z15dsymbolSemanticP7DsymbolP5Scope [0xfbdb1230]
dmd/dtemplate.d:7442 void
dmd.dtemplate.TemplateInstance.expandMembers(dmd.dscope.Scope*).symbolDg(dmd.dsymbol.Dsymbol)
[0xfbdd4408]
dmd/dsymbol.d:97 void
dmd.dsymbol.foreachDsymbol(dmd.root.array.Array!(dmd.dsymbol.Dsymbol).Array*,
void delegate(dmd.dsymbol.Dsymbol)) [0xfbdab5b7]
dmd/dtemplate.d:7447 void
dmd.dtemplate.TemplateInstance.expandMembers(dmd.dscope.Scope*) [0xfbdd4394]
dmd/dtemplate.d:7462 void
dmd.dtemplate.TemplateInstance.tryExpandMembers(dmd.dscope.Scope*) [0xfbdd4472]
dmd/dsymbolsem.d:5634 void
dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance,
dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*)
[0xfbdc16ef]
dmd/dsymbolsem.d:2540 _ZN22DsymbolSemanticVisitor5visitEP16TemplateInstance
[0xfbdb8126]
dmd/dtemplate.d:7491 _ZN16TemplateInstance6acceptEP7Visitor [0xfbdd452d]
dmd/dsymbolsem.d:376 _Z15dsymbolSemanticP7DsymbolP5Scope [0xfbdb1230]
dmd/typesem.d:2734 void dmd.typesem.resolve(dmd.mtype.Type, ref
const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.expression.Expression*,
dmd.mtype.Type*, dmd.dsymbol.Dsymbol*,
bool).visitInstance(dmd.mtype.TypeInstance) [0xfbe8af85]
dmd/typesem.d:2954 void dmd.typesem.resolve(dmd.mtype.Type, ref
const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.expression.Expression*,
dmd.mtype.Type*, dmd.dsymbol.Dsymbol*, bool) [0xfbe8a422]
dmd/typesem.d:1572 dmd.mtype.Type dmd.typesem.typeSemantic(dmd.mtype.Type,
dmd.globals.Loc, dmd.dscope.Scope*).visitInstance(dmd.mtype.TypeInstance)
[0xfbe884e2]
dmd/typesem.d:1814 _Z12typeSemanticP4Type3LocP5Scope [0xfbe8572f]
dmd/dsymbolsem.d:4511 pure  nogc  safe dmd.mtype.Type
dmd.dsymbolsem.DsymbolSemanticVisitor.visit(dmd.dclass.ClassDeclaration).__dgliteral2()
[0xfbdbfd49]
dmd/dsymbolsem.d:4493 dmd.mtype.Type
dmd.dsymbolsem.DsymbolSemanticVisitor.visit(dmd.dclass.ClassDeclaration).resolveBase!(dmd.mtype.Type).resolveBase(lazy
dmd.mtype.Type) [0xfbdc262c]
dmd/dsymbolsem.d:4511 _ZN22DsymbolSemanticVisitor5visitEP16ClassDeclaration
[0xfbdbe094]
dmd/dclass.d:986 _ZN16ClassDeclaration6acceptEP7Visitor [0xfbd7a94d]
dmd/dsymbolsem.d:376 _Z15dsymbolSemanticP7DsymbolP5Scope [0xfbdb1230]
dmd/dtemplate.d:7442 void
dmd.dtemplate.TemplateInstance.expandMembers(dmd.dscope.Scope*).symbolDg(dmd.dsymbol.Dsymbol)
[0xfbdd4408]
dmd/dsymbol.d:97 void
dmd.dsymbol.foreachDsymbol(dmd.root.array.Array!(dmd.dsymbol.Dsymbol).Array*,
void delegate(dmd.dsymbol.Dsymbol)) [0xfbdab5b7]
dmd/dtemplate.d:7447 void
dmd.dtemplate.TemplateInstance.expandMembers(dmd.dscope.Scope*) [0xfbdd4394]
dmd/dtemplate.d:7462 void
dmd.dtemplate.TemplateInstance.tryExpandMembers(dmd.dscope.Scope*) [0xfbdd4472]
dmd/dsymbolsem.d:5634 void
dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance,
dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*)
[0xfbdc16ef]
dmd/dsymbolsem.d:2540 _ZN22DsymbolSemanticVisitor5visitEP16TemplateInstance
[0xfbdb8126]
dmd/dtemplate.d:7491 _ZN16TemplateInstance6acceptEP7Visitor [0xfbdd452d]
dmd/dsymbolsem.d:376 _Z15dsymbolSemanticP7DsymbolP5Scope [0xfbdb1230]
dmd/typesem.d:2734 void dmd.typesem.resolve(dmd.mtype.Type, ref
const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.expression.Expression*,
dmd.mtype.Type*, dmd.dsymbol.Dsymbol*,
bool).visitInstance(dmd.mtype.TypeInstance) [0xfbe8af85]
dmd/typesem.d:2954 void dmd.typesem.resolve(dmd.mtype.Type, ref
const(dmd.globals.Loc), dmd.dscope.Scope*, dmd.expression.Expression*,
dmd.mtype.Type*, dmd.dsymbol.Dsymbol*, bool) [0xfbe8a422]
dmd/typesem.d:1572 dmd.mtype.Type dmd.typesem.typeSemantic(dmd.mtype.Type,
dmd.globals.Loc, dmd.dscope.Scope*).visitInstance(dmd.mtype.TypeInstance)
[0xfbe884e2]
dmd/typesem.d:1814 _Z12typeSemanticP4Type3LocP5Scope [0xfbe8572f]
dmd/expressionsem.d:3201 _ZN25ExpressionSemanticVisitor5visitEP6NewExp
[0xfbdf1f9e]
dmd/expression.d:3290 _ZN6NewExp6acceptEP7Visitor [0xfbde0b49]
dmd/expressionsem.d:10603 _Z18expressionSemanticP10ExpressionP5Scope
[0xfbe09412]
dmd/expressionsem.d:5433 _ZN25ExpressionSemanticVisitor5visitEP10CompileExp
[0xfbdf9df5]
dmd/expression.d:4368 _ZN10CompileExp6acceptEP7Visitor [0xfbde3771]
dmd/expressionsem.d:10603 _Z18expressionSemanticP10ExpressionP5Scope
[0xfbe09412]
dmd/traits.d:1517 dmd.expression.Expression
dmd.traits.semanticTraits(dmd.expression.TraitsExp, dmd.dscope.Scope*)
[0xfbe95015]
dmd/expressionsem.d:4954 _ZN25ExpressionSemanticVisitor5visitEP9TraitsExp
[0xfbdf861c]
dmd/expression.d:3876 _ZN9TraitsExp6acceptEP7Visitor [0xfbde21e1]
dmd/expressionsem.d:10603 _Z18expressionSemanticP10ExpressionP5Scope
[0xfbe09412]
dmd/staticcond.d:83 bool dmd.staticcond.evalStaticCondition(dmd.dscope.Scope*,
dmd.expression.Expression, dmd.expression.Expression, ref bool) [0xfbeaf09f]
dmd/cond.d:858 _ZN17StaticIfCondition7includeEP5Scope [0xfbd5819d]
dmd/statement.d:1439 _ZN20ConditionalStatement7flattenEP5Scope [0xfbe805e6]
dmd/statementsem.d:227 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0xfbe9e87f]
dmd/statement.d:932 _ZN17CompoundStatement6acceptEP7Visitor [0xfbe7f5dd]
dmd/statementsem.d:125 _Z17statementSemanticP9StatementP5Scope [0xfbe9e52e]
dmd/statementsem.d:428 _ZN24StatementSemanticVisitor5visitEP14ScopeStatement
[0xfbe9f37d]
dmd/statement.d:1045 _ZN14ScopeStatement6acceptEP7Visitor [0xfbe7f9e5]
dmd/statementsem.d:125 _Z17statementSemanticP9StatementP5Scope [0xfbe9e52e]
dmd/statementsem.d:402
_ZN24StatementSemanticVisitor5visitEP21UnrolledLoopStatement [0xfbe9f249]
dmd/statement.d:998 _ZN21UnrolledLoopStatement6acceptEP7Visitor [0xfbe7f871]
dmd/statementsem.d:125 _Z17statementSemanticP9StatementP5Scope [0xfbe9e52e]
dmd/statementsem.d:1152 _ZN24StatementSemanticVisitor5visitEP16ForeachStatement
[0xfbea01b0]
dmd/statement.d:1322 _ZN16ForeachStatement6acceptEP7Visitor [0xfbe801d5]
dmd/statementsem.d:125 _Z17statementSemanticP9StatementP5Scope [0xfbe9e52e]
dmd/statementsem.d:234 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0xfbe9e8f3]
dmd/statement.d:932 _ZN17CompoundStatement6acceptEP7Visitor [0xfbe7f5dd]
dmd/statementsem.d:125 _Z17statementSemanticP9StatementP5Scope [0xfbe9e52e]
dmd/semantic3.d:571 _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0xfbeb3866]
dmd/func.d:2371 _ZN15FuncDeclaration6acceptEP7Visitor [0xfbe10c95]
dmd/semantic3.d:82 _Z9semantic3P7DsymbolP5Scope [0xfbeb21b0]
dmd/semantic3.d:1376 _ZN16Semantic3Visitor5visitEP20AggregateDeclaration
[0xfbeb6825]
dmd/parsetimevisitor.d:83
_ZN16ParseTimeVisitorI10ASTCodegenE5visitEP17StructDeclaration [0xfbe97699]
dmd/dstruct.d:612 _ZN17StructDeclaration6acceptEP7Visitor [0xfbdab039]
dmd/semantic3.d:82 _Z9semantic3P7DsymbolP5Scope [0xfbeb21b0]
dmd/semantic3.d:132 _ZN16Semantic3Visitor5visitEP16TemplateInstance
[0xfbeb2350]
dmd/dtemplate.d:7491 _ZN16TemplateInstance6acceptEP7Visitor [0xfbdd452d]
dmd/semantic3.d:82 _Z9semantic3P7DsymbolP5Scope [0xfbeb21b0]
dmd/dtemplate.d:7479 void
dmd.dtemplate.TemplateInstance.trySemantic3(dmd.dscope.Scope*) [0xfbdd44e6]
dmd/dsymbolsem.d:5712 void
dmd.dsymbolsem.templateInstanceSemantic(dmd.dtemplate.TemplateInstance,
dmd.dscope.Scope*, dmd.root.array.Array!(dmd.expression.Expression).Array*)
[0xfbdc18f4]
dmd/dsymbolsem.d:2540 _ZN22DsymbolSemanticVisitor5visitEP16TemplateInstance
[0xfbdb8126]
dmd/dtemplate.d:7491 _ZN16TemplateInstance6acceptEP7Visitor [0xfbdd452d]
dmd/dsymbolsem.d:376 _Z15dsymbolSemanticP7DsymbolP5Scope [0xfbdb1230]
dmd/expressionsem.d:3068 _ZN25ExpressionSemanticVisitor5visitEP8ScopeExp
[0xfbdf1a8e]
dmd/expression.d:3197 _ZN8ScopeExp6acceptEP7Visitor [0xfbde081d]
dmd/expressionsem.d:10603 _Z18expressionSemanticP10ExpressionP5Scope
[0xfbe09412]
dmd/statementsem.d:176 _ZN24StatementSemanticVisitor5visitEP12ExpStatement
[0xfbe9e645]
dmd/statement.d:736 _ZN12ExpStatement6acceptEP7Visitor [0xfbe7ee0d]
dmd/statementsem.d:125 _Z17statementSemanticP9StatementP5Scope [0xfbe9e52e]
dmd/statementsem.d:234 _ZN24StatementSemanticVisitor5visitEP17CompoundStatement
[0xfbe9e8f3]
dmd/statement.d:932 _ZN17CompoundStatement6acceptEP7Visitor [0xfbe7f5dd]
dmd/statementsem.d:125 _Z17statementSemanticP9StatementP5Scope [0xfbe9e52e]
dmd/semantic3.d:571 _ZN16Semantic3Visitor5visitEP15FuncDeclaration [0xfbeb3866]
dmd/func.d:2371 _ZN15FuncDeclaration6acceptEP7Visitor [0xfbe10c95]
dmd/semantic3.d:82 _Z9semantic3P7DsymbolP5Scope [0xfbeb21b0]
dmd/semantic3.d:195 _ZN16Semantic3Visitor5visitEP6Module [0xfbeb25a3]
dmd/dmodule.d:1278 _ZN6Module6acceptEP7Visitor [0xfbd9d4fd]
dmd/semantic3.d:82 _Z9semantic3P7DsymbolP5Scope [0xfbeb21b0]
dmd/mars.d:689 int dmd.mars.tryMain(ulong, const(char)**) [0xfbe4992c]
dmd/mars.d:956 _Dmain [0xfbe4aaaa]


Without assert it compiles with nice error:

aliasthis.d(3): Error: function `aliasthis.Tup!(int, double).Tup.opEquals` has
no return statement, but is expected to return a value of type bool
aliasthis.d(14): Error: template instance `aliasthis.Tup!(int, double)` error
instantiating

--
Dec 18 2018