view gcc/testsuite/gdc.test/fail_compilation/fail238_m32.d @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

// REQUIRED_ARGS: -m32
/*
TEST_OUTPUT:
---
fail_compilation/fail238_m32.d(21): Error: cannot implicitly convert expression `"a"` of type `string` to `uint`
fail_compilation/fail238_m32.d(24): Error: cannot interpret X!() at compile time
fail_compilation/fail238_m32.d(29): Error: template instance fail238_m32.A!"a" error instantiating
fail_compilation/fail238_m32.d(35):        instantiated from here: M!(q)
fail_compilation/fail238_m32.d(35):        while evaluating pragma(msg, M!(q))
---
*/

// Issue 581 - Error message w/o line number in dot-instantiated template

template X(){}

template D(string str){}

template A(string str)
{
    static if (D!(str[str]))
    {}
    else
        const string A = .X!();
}

template M(alias B)
{
    const string M = A!("a");
}

void main()
{
    int q = 3;
    pragma(msg, M!(q));
}