summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/ice15172.d
blob: aa070f6db1b2e31faf9111f9c36d1865edc68293 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
TEST_OUTPUT:
---
fail_compilation/ice15172.d(14): Error: constructor `ice15172.ThreadError.this` no match for implicit `super()` call in constructor
---
*/

// 1. ClassDeclaration.semantic
class ThreadError : Error
{
    // 2. FuncDeclaration.semantic
    // 4. FuncDeclaration.semantic3
    //    --> error happens
    this(string)
    {
    }
}

// 3. FuncDeclaration.semantic
// 5. FuncDeclaration.semantic3
void onThreadError()
{
    // 6. NewExp.semantic
    //    --> cd.members.errors == false, cd.members.semantic3Errors == true
    //    BUT, The ThreadError class constructor is not a template function, so
    //    the errors inside its function body won't be associated with the validness of this NewExp.
    //    Therefore, converting the semantic3Error to ErrorExp is not correct.
    // 7. ctfeInterpret
    //    Finally, FuncDeclaration::interpret may encounter a function which is semantic3Errors == true. So
    //    7a. functionSemantic3() should return false if semantic3Errors is true.
    //    7b. the function body errors may not happen during ctfeInterpret call and global.errors could be unincremented.
    __gshared auto ThreadError = new ThreadError(null);
}