llvm-project
llvm-project copied to clipboard
Incorrect interaction of decltype with `operator<<`
| Bugzilla Link | 40475 |
| Version | unspecified |
| OS | MacOS X |
| CC | @DougGregor,@zygoloid |
Extended Description
I'm running clang-1000.11.45.5 on my mac. To my bafflement, the following snippet compiles and runs, producing "Hello, world!":
struct foo
{
};
decltype(std::stringstream{} << foo{}) f{"Hello, world!"};
//f << foo{};
std::cout << f.str() << '\n';
Reinstating the commented line does at least give the expected compilation error since no appropriate operator<< exists.
As far as I can tell, the problem seems specific to mac.