CreateOr no matching member error

For the following code:

    Type * type = IntegerType::getInt32Ty(getGlobalContext());     
    IRBuilder<> builder(BB);
    std::set<Value *> Vset;
    Value * Vresult=0;  
    for(std::set<Value*>::iterator Vit=Vset.begin();Vit!=Vset.end();Vit++)
      {
        Vresult=builder.CreateOr(Vit, Vresult, "WaitOr");
      }

Vset is inserted in previous loop by 0 or 1 The error is

error: no matching member function for call to 'CreateOr'
                Vresult=builder.CreateOr(Vit, Vresult, "WaitOr");

Which input is wrong in the CreateOr() ?

Hi Rasha,

    Value * Vresult=0;
    for(std::set<Value*>::iterator Vit=Vset.begin();Vit!=Vset.end();Vit++)
      {
        Vresult=builder.CreateOr(Vit, Vresult, "WaitOr");
      }

Which input is wrong in the CreateOr() ?

The first two. Vit needs to be dereferenced "*Vit" and Vresult needs
to be initialised to a real value ("ConstantInt::get(SomeType, 0)"
might make sense) before the first iteration of the loop.

"Vit" is what's causing the compile-time failure though. The other one
will just go wrong at runtime.

Cheers.

Tim.

From: llvmdev-bounces@cs.uiuc.edu [mailto:llvmdev-bounces@cs.uiuc.edu]
On Behalf Of Rasha Omar
Subject: [LLVMdev] CreateOr no matching member error

For the following code:
    Type * type = IntegerType::getInt32Ty(getGlobalContext());
    IRBuilder<> builder(BB);
    std::set<Value *> Vset;
    Value * Vresult=0;
    for(std::set<Value*>::iterator Vit=Vset.begin();Vit!=Vset.end();Vit++)
      {
        Vresult=builder.CreateOr(Vit, Vresult, "WaitOr");
      }
error: no matching member function for call to 'CreateOr'
                Vresult=builder.CreateOr(Vit, Vresult, "WaitOr");
Which input is wrong in the CreateOr() ?

Vit is not of type Value*. Try *Vit in the CreateOr() call.

- Chuck