yes, this is an error. Its not a syntax error, but it is still undefined behavior and incorrect to do.
try it in the compiler!
x3.cpp: In function 'int (& getArr())[2]':
x3.cpp:19:6: warning: reference to local variable 'arr' returned [-Wreturn-local-addr]
int arr[2] = {3,9};
^~~