public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98523] New: Bug with class static definition and non-type template parameters
@ 2021-01-05  6:57 eldlistmailingz at tropicsoft dot com
  2021-12-23  9:29 ` [Bug c++/98523] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: eldlistmailingz at tropicsoft dot com @ 2021-01-05  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98523
           Summary: Bug with class static definition and non-type template
                    parameters
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eldlistmailingz at tropicsoft dot com
  Target Milestone: ---

The code, as test_predicate.cpp:

template < typename T, T *d >  class atmp { atmp() {} };

template < typename T > struct ast
    {
    static T avar;
    static atmp<T,&avar> acst;
    };

template < typename T > T ast<T>::avar;
template < typename T > atmp<T,&ast<T>::avar> ast<T>::acst;

int main() 
    {
    return 0;
    }

The command line:

"/usr/bin/g++"   -fvisibility-inlines-hidden -fPIC -m64 -pthread -O0
-fno-inline -Wall -g -fvisibility=hidden -std=c++11 -c -o "test_predicate.o"
"test_predicate.cpp"

The result:

test_predicate.cpp:10:47: error: conflicting declaration ‘atmp<T, (&
ast<T>::avar)> ast<T>::acst’
   10 | template < typename T > atmp<T,&ast<T>::avar> ast<T>::acst;
      |                                               ^~~~~~
test_predicate.cpp:6:26: note: previous declaration as ‘atmp<T, (&
ast<T>::avar)> ast<T>::acst’
    6 |     static atmp<T,&avar> acst;
      |                          ^~~~

The code compiles successfully with clang-11.0 and with VC++ 14.2 on Windows.

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

* [Bug c++/98523] Bug with class static definition and non-type template parameters
  2021-01-05  6:57 [Bug c++/98523] New: Bug with class static definition and non-type template parameters eldlistmailingz at tropicsoft dot com
@ 2021-12-23  9:29 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-23  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |4.1.2
   Last reconfirmed|                            |2021-12-23
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2021-12-23  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05  6:57 [Bug c++/98523] New: Bug with class static definition and non-type template parameters eldlistmailingz at tropicsoft dot com
2021-12-23  9:29 ` [Bug c++/98523] " pinskia 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).