GCC6: implicit casting triggers error