[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-07-02 Thread David Blaikie via cfe-commits
dwblaikie wrote: > It looks like the presence of `static` on template variable specializations > makes difference in the namespace context: https://gcc.godbolt.org/z/WGsreqbz8 > > Specifically, the specializations not marked `static` result in an exported > variable. Thus, we have seemingly va

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-07-02 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: > I've been hinted though that Clang may be incorrect in accepting explicit > specializations of a templated static class data member in the class scope. > It looks like with all the restrictions in the standard it may only be > allowed to place explicit specializations of a

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-07-02 Thread Alexander Kornienko via cfe-commits
alexfh wrote: Thanks for proposing a fix! I've been hinted though that Clang may be incorrect in accepting explicit specializations of a templated static class data member in the class scope. It looks like with all the restrictions in the standard it may only be allowed to place explicit speci

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-07-02 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: > non-static class member @alexfh Missed this one :) Opened a PR to fix this [here](https://github.com/llvm/llvm-project/pull/97425). https://github.com/llvm/llvm-project/pull/93873 ___ cfe-commits mailing list cfe-commits@lists.llv

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-07-01 Thread via cfe-commits
alexfh wrote: There's more (https://gcc.godbolt.org/z/YKKah8M1n): ``` class D { template static constexpr int kMaxUnsignedInt = 2 * kMaxUnsignedInt + 1; template <> constexpr auto kMaxUnsignedInt<1> = 1; }; ``` fails to compile with ``` :14:11: error: 'auto' not allowed in non-static class mem

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-07-01 Thread via cfe-commits
alexfh wrote: It looks like the presence of `static` on template variable specializations makes difference in the namespace context: https://gcc.godbolt.org/z/b5ns1zhx6 Specifically, the specializations not marked `static` result in an exported variable. Thus, we have seemingly valid code that

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-06-25 Thread David Blaikie via cfe-commits
dwblaikie wrote: Sent a patch to add a warning flag for the warning this patch uses: https://github.com/llvm/llvm-project/pull/96699 With that, we could disable the warning during the compiler migration, decoupling compiler migration from code cleanup. https://github.com/llvm/llvm-project/pul

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-06-24 Thread via cfe-commits
alexfh wrote: Specifically, the problem is that we can't fix code that corresponds to case # 1 from the description, since it produces code corresponding to pattern # 2, which can't compile with current clang. Shipping fixes together with the compiler is not an option for us (and probably for

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-06-24 Thread via cfe-commits
bgra8 wrote: @sdkrystian we need a way to disable the new check so we can do the code fixes for our large codebase while still using the old compiler. As the patch description suggests the correct code is rejected by the current `clang` so we have no path forward here. Can you please add a fl

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-06-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian closed https://github.com/llvm/llvm-project/pull/93873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-06-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/93873 >From 40b69a190a1af610d946108394a38e3ac93dbd71 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 28 May 2024 07:42:06 -0400 Subject: [PATCH 1/5] [Clang][Sema] Diagnose variable template explicit s

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-06-18 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/93873 >From 40b69a190a1af610d946108394a38e3ac93dbd71 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 28 May 2024 07:42:06 -0400 Subject: [PATCH 1/4] [Clang][Sema] Diagnose variable template explicit s

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/93873 >From e638448bce1dd529acbf81592f324bdc1ecb3e19 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 28 May 2024 07:42:06 -0400 Subject: [PATCH 1/3] [Clang][Sema] Diagnose variable template explicit s

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Krystian Stasiowski via cfe-commits
sdkrystian wrote: @mizvekov GCC seems to be right; [[decl.meaning.general] p3.3](eel.is/c++draft/dcl.meaning.general#3.3) requires that the specialized declaration be nominable (per [[basic.scope.scope] p7](eel.is/c++draft/basic.scope.scope#7)) in `S` (which in this case is the global namespa

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Vlad Serebrennikov via cfe-commits
https://github.com/Endilll commented: DR test changes look good. https://github.com/llvm/llvm-project/pull/93873 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Matheus Izvekov via cfe-commits
https://github.com/mizvekov commented: Interestingly, only GCC errors on a case like this: ``` namespace { template int A = 0; } template<> int A = 0; ``` https://godbolt.org/z/TTjssKxz5 https://github.com/llvm/llvm-project/pull/93873 ___ cfe-commi

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian updated https://github.com/llvm/llvm-project/pull/93873 >From e638448bce1dd529acbf81592f324bdc1ecb3e19 Mon Sep 17 00:00:00 2001 From: Krystian Stasiowski Date: Tue, 28 May 2024 07:42:06 -0400 Subject: [PATCH 1/2] [Clang][Sema] Diagnose variable template explicit s

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Matheus Izvekov via cfe-commits
@@ -3561,6 +3562,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, } return nullptr; } +#endif mizvekov wrote: Leftover https://github.com/llvm/llvm-project/pull/93873 ___

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Matheus Izvekov via cfe-commits
@@ -3541,6 +3541,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S, AccessSpecifier AS, Declarator &D, IdentifierInfo *II = Name.getAsIdentifierInfo(); +#if 0 mizvekov wrote: Leftover https://github.com/llvm/llvm-project/pull/93873 _

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Erich Keane via cfe-commits
https://github.com/erichkeane approved this pull request. Sensible to me! Definitely needs a release note. Perhaps an alert on discourse about 'potentially breaking' changes. https://github.com/llvm/llvm-project/pull/93873 ___ cfe-commits mailing li

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-modules Author: Krystian Stasiowski (sdkrystian) Changes According to [[temp.expl.spec] p2](http://eel.is/c++draft/temp.expl.spec#2): > The declaration in an _explicit-specialization_ shall not be an _export-declaration_. An explicit specializatio

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Krystian Stasiowski (sdkrystian) Changes According to [[temp.expl.spec] p2](http://eel.is/c++draft/temp.expl.spec#2): > The declaration in an _explicit-specialization_ shall not be an _export-declaration_. An explicit specialization shall

[clang] [Clang][Sema] Diagnose variable template explicit specializations with storage-class-specifiers (PR #93873)

2024-05-30 Thread Krystian Stasiowski via cfe-commits
https://github.com/sdkrystian created https://github.com/llvm/llvm-project/pull/93873 According to [[temp.expl.spec] p2](http://eel.is/c++draft/temp.expl.spec#2): > The declaration in an _explicit-specialization_ shall not be an > _export-declaration_. An explicit specialization shall not use a