title: Problem with automatically cast Logical vector to integer
body: <p>R api allow to treat SEXP  via pointer directly  which simplify all treatement that depends to cast non original data type.
  For exemple , we can use unsigned int to treat SEXP with reel or integer type . The problem is that R gives the ability to cast 
  automaticly from logical to integer SEXP. Internal R header define logical as C integer type causes -I think - non logic 
  state. for exemple if I use this code:</p>
  
  <pre><code>// [[Rcpp::export]]
  SEXP test(SEXP x){
    int* arr= INTEGER(x);
    arr[0]=77;
    return x;
  } 
  </code></pre>
  
  <p>and I run in R:</p>
  
  <pre><code>x&lt;-NA             ## by default NA is logical vector
  is.logical(x)  ## return TRUE
  test(x)            ## return TRUE 
  is.logical(x)  ## return TRUE
  print(x+0L )   ## normaly will return  TRUE but it gives 77
   max(x)          ## gives 77 !
  </code></pre>
  
  <p>Most basic fuction treat x as integer sum,max,min...
  The same problemes come with Rcpp witch block in-place exchange. For example:</p>
  
  <pre><code>// [[Rcpp::export]]
  IntegerVector test1(IntegerVector x){
    x[0]=77;
    return x;
  } 
  </code></pre>
  
  <p>using R :</p>
  
  <pre><code>x&lt;-NA 
  test1(x)  ## x still NA
  x&lt;-as.integer(x)
  test1(x) ## edit to 77
  </code></pre>
  
  <p>Finally, is there a possibly to overcome this critical  cast from logical  to integer ? </p>