为什么枚举值不能用作右值?

qif*_*ife 9 c++ enums move rvalue c++11

注意:

问题已经解决了.这是一个Clion 1.2.4不是编译器的错误.即使Clion的静态分析工具仍然给我一个错误,我也可以编译应用程序.


我正在使用基于的Clion 1.2.4构建C++项目C++11,当我尝试使用make_shared函数来创建这样的shared_ptr对象时:

auto item = std::make_shared<Type>(EnumType::Value);
Run Code Online (Sandbox Code Playgroud)

where Type是一个带有这样的构造函数的结构:

Type(EnumType t = defaultValue) { }
Run Code Online (Sandbox Code Playgroud)

并且构造函数的参数是枚举类型.

但克里昂给我一个错误:

parameter type mismatch: Expression must be rvalue.
Run Code Online (Sandbox Code Playgroud)

所以我想知道枚举值是否可以用作调用函数的右值?为什么呢.


如果我这样使用:

auto item = std::make_shared<Type>(std::move(EnumType::Value));
Run Code Online (Sandbox Code Playgroud)

Clion不会显示错误.move功能有什么作用?使用常量值作为move函数的实际参数是否正确.

更新2016-01-31:

感谢@ NathanOliver提醒.这里可以看到一个简单的例子(由NathanOliver创建).

以下是命令的结果gcc -v:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.0.72)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
Run Code Online (Sandbox Code Playgroud)