FunctionSpace() does not complain when an object of a type different from MeshObject is passed as the first argument. Instead, it returns an error that is not clear.
Code
library(fdaPDE2)
data("unit_square", package = "fdaPDE2")
domain <- Mesh(unit_square)
Vh <- FunctionSpace(domain, fe_order = 1)
Error
> data("unit_square", package = "fdaPDE2")
> domain <- Mesh(unit_square)
>
> ## the functional space of finite element functions of order 1, over the unit square
> Vh <- FunctionSpace(unit_square, fe_order = 1)
Error in eval(parse(text = paste("cpp_lagrange_basis_", mesh$domain_type, :
object 'cpp_lagrange_basis__fe1' not found