http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49165

--- Comment #15 from Vijay Rao <gcc at portuosus dot com> 2011-05-27 22:19:00 
UTC ---
Ok, thanks for this. While using 4.5.1 I'm also stuck in a toolchain using
3.4.6 for which the latter doesn't fail when one of the conditional args is of
type bool but does give the "void value not ignored as it ought to be" error
when one of the args is of int type which I wasn't getting while using 3.3.2. I
was getting an ICE when using bool for one of the conditional args in 3.3.2
(reported in 14083).

I was wondering whether to try a compiler version > 3.3.2 and < 3.4.6 but if
both issues are going to be covered then it'll be worth the effort, ceteris
paribus, of introducing a version 4 compiler in the toolchain. 

Just goofing around with test cases code:

template<typename R, typename Y, typename C>
struct X 
{
  R f(int x, Y y);
};

template<typename R, typename Y>
struct X<R,Y,bool> 
{
  R f(int x, Y y) {
    return y && (x<2?true:throw 14);
  }
};

template<typename R, typename Y>
struct X<R,Y,int> 
{
  R f(int x, Y y) {
    return y && (x<2? 1 :throw 14);
  }
};

int main(int argc,char**argv)
{
  int x(2);
  try {
    int j(X<int,int,int>()
          .f(x,
             X<int,int,bool>()
             .f(x,
                X<int,bool,int>()
                .f(x,
                   X<bool,bool,bool>()
                   .f(x,
                      X<bool,bool,int>()
                      .f(x,
                         X<bool,int,int>()
                         .f(x, x)
                         )
                      )
                   )
                )
             )
          );
  } catch ( int e ) { if (e!=14) throw; }

  x=argc;
  int k(X<int,int,int>()
        .f(x,
           X<int,int,bool>()
           .f(x,
              X<int,bool,int>()
              .f(x,
                 X<bool,bool,bool>()
                 .f(x,
                    X<bool,bool,int>()
                    .f(x,
                       X<bool,int,int>()
                       .f(x, x)
                       )
                    )
                 )
              )
           )
        );
}

Reply via email to