[PATCH] D68923: Don't warn about missing declarations for partial template specializations

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 4 07:27:48 PST 2020


aaronpuchert added a comment.

In D68923#1853527 <https://reviews.llvm.org/D68923#1853527>, @aaronpuchert wrote:

> In D68923#1853303 <https://reviews.llvm.org/D68923#1853303>, @aaron.ballman wrote:
>
> > I think it's a simple enough fix that it may be worth it, but it isn't fixing a regression in behavior so it's not critical.
>
>
> Exactly, it would just be a bug fix.


Actually it is a regression, but one that we already had in Clang 9. Try <https://godbolt.org/z/dD5hMc> this code:

  template <typename T>
  constexpr bool X = true;
  
  template <typename T>
  constexpr bool X<T*> = false;

Clang 9 emits the following false positive warning, which Clang 8 doesn't emit:

  <source>:5:16: warning: no previous extern declaration for non-static variable 'X<T *>' [-Wmissing-variable-declarations]
  constexpr bool X<T*> = false;
                 ^
  <source>:5:11: note: declare 'static' if the variable is not intended to be used outside of this translation unit
  constexpr bool X<T*> = false;
            ^


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68923





More information about the cfe-commits mailing list