This seems to be a gray area, because Visual C++ 2015 and g++ 5.1 differ
in their opinion of almost identical source code:
#include <iostream>
#include <stddef.h>
#include <string>
typedef int const* HWND;
HWND GetHwnd() {return NULL;}
struct ControlBase
{
explicit ControlBase(HWND) {}
void Text( std::string const& t) {std::cout << t << std::endl;}
};
int main()
{
std::string title = "works";
// No + ... g++ accepts it, but MSVC issues compilation error.
ControlBase(GetHwnd()); //.Text(title);
}
g++ 5.1.0 accepts it, while Visual C++ 2015 produces this compilation error:
> foo.cpp(19): error C2556: 'ControlBase GetHwnd(void)': overloaded function differs only by return type from 'HWND GetHwnd(void)'
> foo.cpp(7): note: see declaration of 'GetHwnd'
> foo.cpp(19): error C2040: 'GetHwnd': 'ControlBase (void)' differs in levels of indirection from 'HWND (void)'
This indicates to me that it's /possible/ to parse the first part as a
function declaration. Adding a unary `+` removes the MSVC error. And so
I conclude that the most vexing parse is involved for the modified code,
and somehow -- unspecified -- was the reason for original error.
Cheers & sorry for not having the whole story,
- Alf