mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 13:10:12 +03:00
Fix bugzilla 24764 - ICE when -vcg-ast prints imported invariant (#16917)
Co-authored-by: Dennis Korpel <dennis@sarc.nl>
This commit is contained in:
parent
f420f988ab
commit
e0259d92e7
4 changed files with 39 additions and 3 deletions
|
@ -1858,9 +1858,9 @@ void toCBuffer(Dsymbol s, ref OutBuffer buf, ref HdrGenState hgs)
|
|||
if (stcToBuffer(buf, d.storage_class))
|
||||
buf.writeByte(' ');
|
||||
buf.writestring("invariant");
|
||||
if(auto es = d.fbody.isExpStatement())
|
||||
auto es = d.fbody.isExpStatement();
|
||||
if (es && es.exp && es.exp.op == EXP.assert_)
|
||||
{
|
||||
assert(es.exp && es.exp.op == EXP.assert_);
|
||||
buf.writestring(" (");
|
||||
(cast(AssertExp)es.exp).e1.expressionToBuffer(buf, hgs);
|
||||
buf.writestring(");");
|
||||
|
|
|
@ -100,6 +100,12 @@ void main()
|
|||
values();
|
||||
return 0;
|
||||
}
|
||||
import imports.vcg_ast_import;
|
||||
template imported()
|
||||
{
|
||||
import imported = imports.vcg_ast_import;
|
||||
}
|
||||
alias myImport = vcg_ast_import;
|
||||
R!int
|
||||
{
|
||||
struct _R
|
||||
|
@ -126,6 +132,21 @@ mixin _d_cmain!();
|
|||
}
|
||||
}
|
||||
}
|
||||
imported!()
|
||||
{
|
||||
import object;
|
||||
struct O
|
||||
{
|
||||
invariant
|
||||
{
|
||||
}
|
||||
invariant
|
||||
{
|
||||
__invariant0();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
RTInfo!(C)
|
||||
{
|
||||
enum immutable(void)* RTInfo = null;
|
||||
|
@ -150,4 +171,3 @@ RTInfo!(_R)
|
|||
enum immutable(void)* RTInfo = null;
|
||||
|
||||
}
|
||||
|
||||
|
|
4
compiler/test/compilable/imports/vcg_ast_import.d
Normal file
4
compiler/test/compilable/imports/vcg_ast_import.d
Normal file
|
@ -0,0 +1,4 @@
|
|||
struct O
|
||||
{
|
||||
invariant() {}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
REQUIRED_ARGS: -vcg-ast -o-
|
||||
PERMUTE_ARGS:
|
||||
OUTPUT_FILES: compilable/vcg-ast.d.cg
|
||||
EXTRA_FILES: imports/vcg_ast_import.d
|
||||
TEST_OUTPUT_FILE: extra-files/vcg-ast.d.cg
|
||||
*/
|
||||
|
||||
|
@ -63,3 +64,14 @@ void main()
|
|||
{
|
||||
values!wchar_t;
|
||||
}
|
||||
|
||||
// https://issues.dlang.org/show_bug.cgi?id=24764
|
||||
|
||||
import imports.vcg_ast_import;
|
||||
|
||||
template imported()
|
||||
{
|
||||
import imported = imports.vcg_ast_import;
|
||||
}
|
||||
|
||||
alias myImport = imported!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue