Thread overview
[Issue 14249] Loose error check for incorrect template mixin
Mar 05, 2015
Kenji Hara
Mar 05, 2015
Kenji Hara
March 05, 2015
https://issues.dlang.org/show_bug.cgi?id=14249

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> ---
And, the error diagnostic for other invalid cases is not good.

mixin template Mix()
{
    shared static this() {}
//  shared static ~this() {}
    static this() {}
//  static ~this() {}
//  unittest {}
    invariant {}
    alias a this;
    new(size_t sz) { return null; }
    delete(void* p) { }
    this(int) {}
    this(this) {}
    ~this() {}
    union { int x; double y; }
}
void main()
{
    mixin Mix!();
}

test.d(8): Error: function test.main.Mix!().__invariant6 invariants are only
for struct/union/class definitions
test.d(9): Error: alias this test.main.Mix!().__anonymous alias this can only
appear in struct or class declaration, not main
test.d(10): Error: allocator test.main.Mix!().new new allocators only are for
class or struct definitions
test.d(11): Error: deallocator test.main.Mix!().delete new allocators only are
for class or struct definitions
test.d(12): Error: constructor test.main.Mix!().this constructors are only for
class or struct definitions
test.d(13): Error: function test.main.Mix!().__postblit post blits are only for
struct/union definitions, not function main
test.d(14): Error: destructor test.main.Mix!().~this destructors are only for
class/struct/union definitions, not function main
test.d(15): Error: anonymous union __anonymous can only be a part of an
aggregate
test.d(3): Error: function test.main.Mix!()._sharedStaticCtor4 static
constructor can only be member of struct/class/module, not function main
test.d(5): Error: function test.main.Mix!()._staticCtor5 static constructor can
only be member of struct/class/module, not function main
test.d(19): Error: mixin test.main.Mix!() error instantiating

--
March 05, 2015
https://issues.dlang.org/show_bug.cgi?id=14249

Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> ---
https://github.com/D-Programming-Language/dmd/pull/4454

--
April 09, 2015
https://issues.dlang.org/show_bug.cgi?id=14249

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
April 09, 2015
https://issues.dlang.org/show_bug.cgi?id=14249

--- Comment #3 from github-bugzilla@puremagic.com ---
Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bdc92c7c244398a361261369c3f59daccaa62664 fix Issue 14249 - Loose error check for incorrect template mixin

--
June 17, 2015
https://issues.dlang.org/show_bug.cgi?id=14249

--- Comment #4 from github-bugzilla@puremagic.com ---
Commit pushed to stable at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/bdc92c7c244398a361261369c3f59daccaa62664 fix Issue 14249 - Loose error check for incorrect template mixin

--