public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65514] New: Initializing a non-static const data member of a template class from a static const data member of another template class results in errors in certain situations
@ 2015-03-22 14:50 nilschrbrause at googlemail dot com
  2015-03-22 15:28 ` [Bug c++/65514] " redi at gcc dot gnu.org
  2015-03-22 16:04 ` redi at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: nilschrbrause at googlemail dot com @ 2015-03-22 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65514
           Summary: Initializing a non-static const data member of a
                    template class from a static const data member of
                    another template class results in errors in certain
                    situations
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nilschrbrause at googlemail dot com

Created attachment 35093
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35093&action=edit
Test source

% g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc-multilib/src/gcc-4.9-20150304/configure
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--disable-libssp --enable-gnu-unique-object --enable-linker-build-id
--enable-cloog-backend=isl --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu --enable-multilib
--disable-werror --enable-checking=release
Thread model: posix
gcc version 4.9.2 20150304 (prerelease) (GCC)

% g++ -std=c++11 test.cpp
test.cpp:12:25: error: expected ‘;’ at end of member declaration
   const int is = add<1, x>::is;
                         ^
test.cpp:12:25: error: declaration of ‘const int add1<x>::x’
test.cpp:8:11: error:  shadows template parm ‘int x’
 template <int x> 
           ^
test.cpp:12:26: error: expected unqualified-id before ‘>’ token
   const int is = add<1, x>::is;
                          ^
test.cpp:12:22: error: wrong number of template arguments (1, should be 2)
   const int is = add<1, x>::is;
                      ^
test.cpp:2:7: error: provided for ‘template<int x, int y> class add’
 class add 
       ^

Source code is attached.

The error vanishes, when:
- a 'static' is added: const static int is = add<1, x>::is;
- the '1' and the 'x' are reversed: const int is = add<x, 1>::is;
- the RHS is enclosed in paranthesis: const int is = (add<1, x>::is);
>From gcc-bugs-return-481112-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Sun Mar 22 13:44:44 2015
Return-Path: <gcc-bugs-return-481112-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 74761 invoked by alias); 22 Mar 2015 13:44:44 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 74728 invoked by uid 48); 22 Mar 2015 13:44:40 -0000
From: "maltsevm at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65513] gcc stops with "internal compiler error"
Date: Sun, 22 Mar 2015 14:52:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.9.2
X-Bugzilla-Keywords:
X-Bugzilla-Severity: blocker
X-Bugzilla-Who: maltsevm at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-65513-4-fUvJx0cKjA@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65513-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65513-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-03/txt/msg02256.txt.bz2
Content-length: 856

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide513

Mikhail Maltsev <maltsevm at gmail dot com> changed:

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

--- Comment #2 from Mikhail Maltsev <maltsevm at gmail dot com> ---
Reproduced on current commit in branch 4.9, fixed on trunk.

What is interesting about this bug, is that when I reduced it, I got a testcase
identical to PR65154 (which also gives ICE on 5.0). So, here is a testcase
reduced in such way, that it's behavior differs (ICE on 4.9, OK for 5.0):

namespace std {
template <typename _Tp> struct atomic {
  atomic() = default;
  atomic(_Tp);
};
}
class {
public:
  std::atomic<bool> bReadyToFlush;
}

LogThreadsleLogEntries[10]{};


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

* [Bug c++/65514] Initializing a non-static const data member of a template class from a static const data member of another template class results in errors in certain situations
  2015-03-22 14:50 [Bug c++/65514] New: Initializing a non-static const data member of a template class from a static const data member of another template class results in errors in certain situations nilschrbrause at googlemail dot com
@ 2015-03-22 15:28 ` redi at gcc dot gnu.org
  2015-03-22 16:04 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-22 15:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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


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

* [Bug c++/65514] Initializing a non-static const data member of a template class from a static const data member of another template class results in errors in certain situations
  2015-03-22 14:50 [Bug c++/65514] New: Initializing a non-static const data member of a template class from a static const data member of another template class results in errors in certain situations nilschrbrause at googlemail dot com
  2015-03-22 15:28 ` [Bug c++/65514] " redi at gcc dot gnu.org
@ 2015-03-22 16:04 ` redi at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-22 16:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Sorry, meant to mark as DUPLICATE not FIXED

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


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

end of thread, other threads:[~2015-03-22 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-22 14:50 [Bug c++/65514] New: Initializing a non-static const data member of a template class from a static const data member of another template class results in errors in certain situations nilschrbrause at googlemail dot com
2015-03-22 15:28 ` [Bug c++/65514] " redi at gcc dot gnu.org
2015-03-22 16:04 ` 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).