[pkg-d-commits] [ldc] 74/149: To check magic LDC UDAs parameter types, convert them to their basetype first. (#1994)

Matthias Klumpp mak at moszumanska.debian.org
Sun Apr 23 22:36:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

mak pushed a commit to annotated tag v1.2.0
in repository ldc.

commit f0754250dc02061c08411cc89037eeb98414c219
Author: Johan Engelen <jbc.engelen at gmail.com>
Date:   Fri Feb 3 19:51:37 2017 +0100

    To check magic LDC UDAs parameter types, convert them to their basetype first. (#1994)
    
    With this, you can check enums with Type::tint32, instead of constructing the enum type. For example: `checkStructElems(sle, {Type::tint32})` for this UDA:
    ```
    enum E {a,b,c};
    struct exampleUDA
    {
       E e;
    }
    ```
---
 gen/uda.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gen/uda.cpp b/gen/uda.cpp
index 0d3f925..15ee68d 100644
--- a/gen/uda.cpp
+++ b/gen/uda.cpp
@@ -78,7 +78,7 @@ void checkStructElems(StructLiteralExp *sle, ArrayParam<Type *> elemTypes) {
   }
 
   for (size_t i = 0; i < sle->elements->dim; ++i) {
-    if ((*sle->elements)[i]->type != elemTypes[i]) {
+    if ((*sle->elements)[i]->type->toBasetype() != elemTypes[i]) {
       sle->error("invalid field type in 'ldc.attributes.%s'; does druntime not "
                  "match compiler version?",
                  sle->sd->ident->string);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-d/ldc.git



More information about the pkg-d-commits mailing list