---
title: "D语言 struct constrcutor 的 bug"
author: "oldrev"
date: "2008-09-06T14:01:53Z"
tags: []
slug: "d-struct-constrcutor-bug"
draft: false
lastmod: "2008-09-06T14:01:53Z"
id: 237891
url: "https://oldrev.iteye.com/blog/237891"
---

今天有空测试了一下 D语言 2.0 最新增加的 struct constructor 特性，结果刚来就发现一个大 bug:

```
import std.stdio;

struct Foo
{
    int x;
    int y;
}

void main()
{
    Foo f3 = 123;
}
```

 上面这个程序居然能在 DMD 2.019 的编译器上编译通过，真是不可思议。