Internally these would treat the cast same as a normal conversion from int[7] to int[], which allows code at CTFE to erroneously succeed where it would raise a SEGV at run-time.
1 |
/**
|
|
2 |
* Defines the base class for all nodes which are part of the AST.
|
|
3 |
*
|
|
4 |
* Copyright: Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved
|
|
5 |
* Authors: $(LINK2 http://www.digitalmars.com, Walter Bright)
|
|
6 |
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
|
|
7 |
* Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/ast_node.d, _ast_node.d)
|
|
8 |
* Documentation: https://dlang.org/phobos/dmd_ast_node.html
|
|
9 |
* Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/ast_node.d
|
|
10 |
*/
|
|
11 |
module dmd.ast_node; |
|
12 |
|
|
13 |
import dmd.root.rootobject : RootObject; |
|
14 |
import dmd.visitor : Visitor; |
|
15 |
|
|
16 |
/// The base class of all AST nodes.
|
|
17 | 1 |
extern (C++) abstract class ASTNode : RootObject |
18 |
{
|
|
19 |
/**
|
|
20 |
* Visits this AST node using the given visitor.
|
|
21 |
*
|
|
22 |
* Params:
|
|
23 |
* v = the visitor to use when visiting this node
|
|
24 |
*/
|
|
25 |
abstract void accept(Visitor v); |
|
26 |
}
|
Read our documentation on viewing source code .