[PATCH] D62202: Work around a Visual C++ bug

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 08:55:35 PDT 2019


dblaikie added a comment.

In D62202#1510394 <https://reviews.llvm.org/D62202#1510394>, @probinson wrote:

> To provide some missing details:
>  The original source gets a bogus compile-time error with Visual Studio 2017, prior to version 15.8.  I have 15.2, so I need this patch to build Clang.
>  Our current minimum-version requirement (per CheckCompilerVersion.cmake) is Visual Studio 2015 (some specific update), which assumes all Visual Studio 2017 versions are usable.  So by that criterion, we need this patch for all Visual Studio 2017 versions to be usable.
>  Arguably the anonymous-namespace version is the "more modern" tactic anyway, so as a long-term fix this is actually fine anyway.


Technically this violates the LLVM style guide which says "make anonymous namespaces as small as possible, and only use them for class declarations." (preferring static for functions) - https://llvm.org/docs/CodingStandards.html#anonymous-namespaces

But making code work for the compilers we say we support seems reasonable to me.

What's the compiler bug - can't handle static functions as non-type template parameters in general? Are there other workarounds to consider?

> My hesitation is... it *is* a compiler bug, and I'm working around it... wondered what y'all think about it.




Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62202/new/

https://reviews.llvm.org/D62202





More information about the cfe-commits mailing list