int main(){
int x{};
auto x2 = x;
auto x3{x};
static_assert(is_same<int, decltype(x)>::value, "decltype(x) is the same as int");
static_assert(is_same<int, decltype(x2)>::value, "decltype(x2) is the same as int");
static_assert(is_same<int, decltype(x3)>::value, "decltype(x3) is the same as int"); // Error here.
}
यह कोड gcc 4.8.0 के साथ संकलित नहीं करता है। मुझे decltype(x3)
के प्रकार का अनुमान भी नहीं लगता है। यह क्या है? और व्यवहार अलग क्यों है?ऑटो को अलग-अलग क्यों निकाला जाता है?
घोषणा त्रुटियों .... –
@GrijeshChauhan आप अधिक विशिष्ट हो सकता है? – Sungmin
'ऑटो एक्स {y}' एक 'std :: startizer_list' है। – Xeo