https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66287
--- Comment #1 from Mitsuru Kariya <kariya_mitsuru at hotmail dot com> --- I found several examples that cause the similar error message. =========== sample code 1 =========== constexpr int copy(const int& v) { return v; } constexpr const int& r = 42; constexpr const int& c = copy(r); int main() {} =========== sample code 1 =========== ================================== output 1 ================================== prog.cc:7:32: error: modification of '_ZGR1c1' is not a constant-expression constexpr const int& c = copy(r); ^ ================================== output 1 ================================== cf. http://melpon.org/wandbox/permlink/fbHQBPKu1LETPmIr =========== sample code 2 =========== struct T { int i; }; constexpr T copy(const T& v) { return v; } constexpr const auto& r = T{42}; constexpr const auto& c = copy(r); int main() {} =========== sample code 2 =========== ================================== output 2 ================================== prog.cc:11:33: error: modification of '_ZGR1c1' is not a constant-expression constexpr const auto& c = copy(r); ^ ================================== output 2 ================================== cf. http://melpon.org/wandbox/permlink/0KeNtSOZrybNAnxa I think these examples should be compiled successfully, but I am not sure about the latter case because CLANG also rejects it.