public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100231] New: [C++17] Variable template specialization inside a class gives compilation error
@ 2021-04-23 12:56 krzyk240 at gmail dot com
  2021-05-30 19:22 ` [Bug c++/100231] " wjwray at gmail dot com
  2021-08-23 11:35 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: krzyk240 at gmail dot com @ 2021-04-23 12:56 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100231

            Bug ID: 100231
           Summary: [C++17] Variable template specialization inside a
                    class gives compilation error
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: krzyk240 at gmail dot com
  Target Milestone: ---

On the following code:
```
template<class T>
struct X {};

class Foo {
    template<class...>
    static constexpr inline bool bar = false;
    template<class T>
    static constexpr inline bool bar<X<T>> = true;
};
```
GCC gives error:
<source>:8:34: error: explicit template argument list not allowed
    8 |     static constexpr inline bool bar<X<T>> = true;
      |                                  ^~~~~~~~~

But Clang, ICC and MSVC compile it correctly.

Defining variable template bar outside of Foo class produces no compile errors.

Compilation command: g++ example.cpp -std=c++17

Live example: https://godbolt.org/z/54hqYxe4P

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/100231] [C++17] Variable template specialization inside a class gives compilation error
  2021-04-23 12:56 [Bug c++/100231] New: [C++17] Variable template specialization inside a class gives compilation error krzyk240 at gmail dot com
@ 2021-05-30 19:22 ` wjwray at gmail dot com
  2021-08-23 11:35 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: wjwray at gmail dot com @ 2021-05-30 19:22 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100231

Will Wray <wjwray at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wjwray at gmail dot com

--- Comment #1 from Will Wray <wjwray at gmail dot com> ---
Duplicate bug 90031
on any partial specialization of a variable template in class scope

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/100231] [C++17] Variable template specialization inside a class gives compilation error
  2021-04-23 12:56 [Bug c++/100231] New: [C++17] Variable template specialization inside a class gives compilation error krzyk240 at gmail dot com
  2021-05-30 19:22 ` [Bug c++/100231] " wjwray at gmail dot com
@ 2021-08-23 11:35 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2021-08-23 11:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100231

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
yup, dup

*** This bug has been marked as a duplicate of bug 90031 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-23 11:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 12:56 [Bug c++/100231] New: [C++17] Variable template specialization inside a class gives compilation error krzyk240 at gmail dot com
2021-05-30 19:22 ` [Bug c++/100231] " wjwray at gmail dot com
2021-08-23 11:35 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).