Odd behavior in object creation using std::unique_ptr. Here are two example :
#include<iostream> 
#include<memory> 
using namespace std; 
class A 
{ 
public: 
    A() {
        throw "EOF";
    }
  void show() 
  { 
    cout<<"A::show()"<<endl; 
  } 
}; 
int main() 
{ 
    try {
      unique_ptr<A> p1 = make_unique<A>(); 
      p1 -> show(); 
    } catch(...) {
        cout << "Exception" << endl;
    }     
  return 0; 
} 
Output
Exception
This above output looks obvious. But, the below code's output is Odd.
// C++ program to illustrate the use of unique_ptr 
#include<iostream> 
#include<memory> 
using namespace std; 
class A 
{ 
public: 
    A() {
        throw "EOF";
    }
  void show() 
  { 
    cout<<"A::show()"<<endl; 
  } 
}; 
int main() 
{ 
    try {
      unique_ptr<A> p1; 
      p1 -> show(); 
    } catch(...) {
        cout << "Exception" << endl;
    }
  return 0; 
} 
Output
A::show()
These example are compiled with c++14 compiler. Is the above output expected behavior?
 
     
     
    