Ambiguous call that doesn't appear to be ambiguous

Viewed 194

Working in C++/CLI using dotnetcore 3.1. Maybe I've just been staring at this too long but I'm just not seeing it. Here is a constructor for one of my classes...

FooReader::FooReader(Stream^ stream) : FooReader()
{
   _streamReader = gcnew StreamReader(stream);
   _ownStreamReader = true;
}

When compiling I get the following...

ambiguous call to overloaded function could be 'System::IO::StreamReader::StreamReader(System::IO::Stream ^,System::Text::Encoding ^,bool,int,bool)' or 'System::IO::StreamReader::StreamReader(System::IO::Stream ^) while trying to match the argument list '(System::IO::Stream ^)'

According to MSDN there are only two constructors for StreamReader that take one argument... one takes a String^ and the other takes a Stream^. Looks to me like I have an exact match to one of the signatures... where is the ambiguity? I feel like I'm missing something obvious here.

0 Answers
Related