]> git.tdb.fi Git - builder.git/blobdiff - source/msvclinker.cpp
Use dynamic_cast to reference when incorrect type is not acceptable
[builder.git] / source / msvclinker.cpp
index 8ff4d9cdd96dc98df028f60d80c579a2b7c40550..4495db7260f533b3a6842e7641e4da5af5a70b37 100644 (file)
@@ -36,12 +36,7 @@ Target *MsvcLinker::create_target(const list<Target *> &sources, const string &a
 
        list<ObjectFile *> objs;
        for(Target *s: sources)
-       {
-               if(ObjectFile *obj = dynamic_cast<ObjectFile *>(s))
-                       objs.push_back(obj);
-               else
-                       throw invalid_argument("MsvcLinker::create_target");
-       }
+               objs.push_back(&dynamic_cast<ObjectFile &>(*s));
 
        const Component &comp = *objs.front()->get_component();
        Binary *bin = 0;