Fix a const preservation issue when using typedefs