Consider this very simple code:
#include <memory>
class Foo
{
public:
    Foo() {};
};
class Bar
{
public:
    Bar( const std::shared_ptr<Foo>& foo ) {}
}; 
int main()
{
    Foo* foo = new Foo;
    Bar bar( std::shared_ptr<Foo>( foo ) );
    return 0;
}
Why does Visual Studio reports
warning C4930: 'Bar bar(std::shared_ptr<Foo>)': prototyped function not called (was a variable definition intended?)
and there is no bar object created...how can this line Bar bar( std::shared_ptr<Foo>( foo ) ); be interpreted as a function definition?
I checked Do the parentheses after the type name make a difference with new? and also C++: warning: C4930: prototyped function not called (was a variable definition intended?), but I feel my problem is different here as I did not use the syntax Foo() nor Bar().
Edit: Note that it successfully compiles:
Foo* foo = new Foo;
std::shared_ptr<Foo> fooPtr( foo );
Bar bar( fooPtr );
 
     
    