microsoft / cppwinrt

C++/WinRT
MIT License
1.64k stars 236 forks source link

Fix cpp20 source location test failure resulting from newer compiler #1326

Closed dmachaj closed 1 year ago

dmachaj commented 1 year ago

What's this all about? Fix a test case failure caused by changing compiler behavior in a newer compiler version. The signature that MSVC provides for source_location has changed recently.

Instead of chasing the full decorated name, with each compiler having a slight variation, we now match just the meaningful substring that we care about "FailOnLine15". This should now be stable across compilers and across compiler versions.

Fixes: #1325

sylveon commented 1 year ago

Would it make more sense to validate that functionNameSv contains the name of the function instead of using a strict ==

dmachaj commented 1 year ago

Would it make more sense to validate that functionNameSv contains the name of the function instead of using a strict ==

That's a good point. That should still provide the validation we need while also being far more stable. Great suggestion 👍