Arduino Code will compile with one board but not another

I can compile the code just fine when I am using an Arduino Uno or whatever, however for some reason with the Trinket M0 it won't compile. I have uploaded the board and drivers as discribed on the adafruit website so I am confused what is going on... This is the portion of the code giving me trouble:

   if (Serial.available() > 1) {  // when serialport is attached and sending values this code cycles
    byte input1[2];                 
    Serial.readBytes(input1, 2);  // 2 values recieved through serial port
    x = int(input1[0]);   // stores values
    y= int(input1[1]);

It gives this error message:

Arduino: 1.8.5 (Windows 10), Board: "Adafruit Trinket M0"

error: invalid conversion from 'byte* {aka unsigned char*}' to 'char*' [-fpermissive]

Serial.readBytes(input1, 2); // 2 values recieved through serial port

^

In file included from C:\Users\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.2.9\cores\arduino/Arduino.h:130:0,

from sketch\Code_no_I2C_M0.ino.cpp:1:

C:\Users\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.2.9\cores\arduino/USB/USBAPI.h:140:9: error: initializing argument 1 of 'size_t Serial_::readBytes(char*, size_t)' [-fpermissive]

size_t readBytes(char *buffer, size_t length);

^

exit status 1 invalid conversion from 'byte* {aka unsigned char*}' to 'char*' [-fpermissive]

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

There must be something else, because when I try to compile this sketch on the IDE 1.8.2, I don't get any compilation error.

void setup() {
  Serial.begin(115200);
}

void loop() {
  if (Serial.available() > 1) {  // when serialport is attached and sending values this code cycles
    byte input1[2];
    Serial.readBytes(input1, 2);  // 2 values recieved through serial port
    int x = int(input1[0]);   // stores values
    int y = int(input1[1]);
  }
}

I just added "int" before x and y, and the Serial.begin.

Which board do you have selected when you compile it? The Adafruit Trinket M0?

Here's a minimal complete code to demonstrate the issue:

void setup() {
  byte foo[2];
  Serial.readBytes(foo, 2);
}

void loop() {}

If I compile that for Adafruit Feather M0 I get:

C:\Users\per\AppData\Local\Temp\arduino_modified_sketch_9059\sketch_jan30a.ino: In function 'void setup()':

sketch_jan30a:3:26: error: invalid conversion from 'byte* {aka unsigned char*}' to 'char*' [-fpermissive]

   Serial.readBytes(foo, 2);

                          ^

In file included from C:\Users\per\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.2.9\cores\arduino/Arduino.h:130:0,

                 from C:\Users\per\AppData\Local\Temp\arduino_build_186839\sketch\sketch_jan30a.ino.cpp:1:

C:\Users\per\AppData\Local\Arduino15\packages\adafruit\hardware\samd\1.2.9\cores\arduino/USB/USBAPI.h:140:9: error:   initializing argument 1 of 'size_t Serial_::readBytes(char*, size_t)' [-fpermissive]

  size_t readBytes(char *buffer, size_t length);

         ^

If I compile it for Arduino Zero, there are no errors.

Adafruit SAMD Boards and Arduino SAMD boards both have the same signatures for readBytes:

size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer
size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); }

Even if I change the type of foo to uint8_t, the same behavior occurs.

I'm confused as to why the second signature is ignored when using Adafruit SAMD Boards.

As for a workaround, you can see that there is no magic to the version of readBytes that takes a uint8_t * parameter. It's easy enough to do that same cast in your own code to make it work with the version that takes the char * parameter:

if (Serial.available() > 1) {  // when serialport is attached and sending values this code cycles
byte input1[2];                 
Serial.readBytes((char *)input1, 2);  // 2 values recieved through serial port