जीसीसी 4.2 में मिलान नहीं खंड, इस काम करता है:Xcode/LLVM पकड़ ली गई प्रकार
#include <stdexcept>
#include <iostream>
int main() {
try {
throw std::runtime_error("abc");
} catch (const std::exception& ex) {
std::cout << ex.what();
}
}
Xcode 4.3.2 में (आईओएस LLVM 3.1 के साथ, -std = C++ 11), इस terminate called throwing an exception
के साथ विफल नहीं, कभी नहीं पहुँच रहा NSLog(…)
लाइन:
#include <stdexcept>
int main() {
try {
throw std::runtime_error("abc");
} catch (const std::exception& ex) {
NSLog(@"%s", ex.what());
}
return UIApplicationMain(argc, argv, nil, nil);
}
लेकिन यह काम करता है:
#include <stdexcept>
int main() {
try {
throw std::runtime_error("abc");
} catch (const std::runtime_error& ex) {
NSLog(@"%s", ex.what());
}
return UIApplicationMain(argc, argv, nil, nil);
}
क्या देता है?
'const' बाहर ले और हमें बताएं कि आपको क्या मिलता है। –
@MarkRansom: कोई बदलाव नहीं। मैंने कोशिश की ... पकड़ो (std :: अपवाद पूर्व) ... 'भी; फिर, कोई बदलाव नहीं। –