public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/63415] New: internal compiler error: unexpected expression ‘static_cast<int>(std::is_same<T, A1>{})’ of kind static_cast_expr
@ 2014-09-30 12:20 tnozicka at gmail dot com
  2014-09-30 12:51 ` [Bug c++/63415] " trippels at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: tnozicka at gmail dot com @ 2014-09-30 12:20 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 63415
           Summary: internal compiler error: unexpected expression
                    ‘static_cast<int>(std::is_same<T, A1>{})’ of kind
                    static_cast_expr
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tnozicka at gmail dot com

Hi, 
g++ asked me to submit a bug report, so here it is :)



=== ERROR ===
main.cpp:37:69: internal compiler error: unexpected expression
‘static_cast<int>(std::is_same<T, A1>{})’ of kind static_cast_expr
  static constexpr int value = static_cast<int>(std::is_same<T, A1>{});
                                                                     ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.



=== SOURCE ===
#include <type_traits>
template<typename T, typename A1, typename... Args>
struct CountType
{
    static constexpr int value = CountType<T, A1>::value + CountType<T,
Args...>::value;

    constexpr operator int() const
    {
        return value;
    }
};

template<typename T, typename A1>
struct CountType<T, A1>
{
//    static constexpr int value = static_cast<int>(std::is_same<T, A1>());  //
this works
    static constexpr int value = static_cast<int>(std::is_same<T, A1>{});

    constexpr operator int() const
    {
        return value;
    }
};


template<typename T, typename... Args>
using CountDecayType = CountType<T, std::decay_t<Args>...>;


template<typename... Args>
void foo(Args&&... args)
{
    int i = CountDecayType<int, Args...>{};
}


int main()
{
    foo(5, 6L, 5, 5);

    return 0;
}



=== g++ flags ===
-std=c++14 -pedantic-errors -Wall -Wextra  -gdwarf-2

=== configure ===
Using built-in specs.
COLLECT_GCC=/opt/szn/bin/g++-4.9
COLLECT_LTO_WRAPPER=/opt/szn/lib/gcc/x86_64-linux-gnu/4.9.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: /home/tomas/packages/gcc/gcc-4.9.1/configure --prefix=/opt/szn
--program-suffix=-4.9 --enable-languages=c++ --disable-multilib --enable-shared
--enable-threads=posix --enable-checking=release --enable-__cxa_atexit
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-plugin --with-tune=generic
--enable-libstdcxx-time=yes --enable-libstdcxx-debug
--enable-version-specific-runtime-libs --enable-objc-gc --enable-clocale=gnu
--disable-install-libiberty --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu --libdir=/opt/szn/lib --libexecdir=/opt/szn/lib
--infodir=/opt/szn/share/info-gcc-4.9 --localedir=/opt/szn/share/locale-gcc-4.9
--mandir=/opt/szn/share/man-gcc-4.9
--with-gxx-include-dir=/opt/szn/include/c++/4.9
Thread model: posix
gcc version 4.9.1 (GCC)
>From gcc-bugs-return-462926-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 30 12:22:21 2014
Return-Path: <gcc-bugs-return-462926-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 24402 invoked by alias); 30 Sep 2014 12:22:21 -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 24247 invoked by uid 48); 30 Sep 2014 12:22:17 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/63414] template parse error using < operator
Date: Tue, 30 Sep 2014 12:22: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: 5.0
X-Bugzilla-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: pinskia at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
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: bug_status resolution
Message-ID: <bug-63414-4-VJyGOXBkLd@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63414-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63414-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: 2014-09/txt/msg02760.txt.bz2
Content-length: 503

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

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

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 10200.

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


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

end of thread, other threads:[~2014-10-15 16:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-30 12:20 [Bug c++/63415] New: internal compiler error: unexpected expression ‘static_cast<int>(std::is_same<T, A1>{})’ of kind static_cast_expr tnozicka at gmail dot com
2014-09-30 12:51 ` [Bug c++/63415] " trippels at gcc dot gnu.org
2014-10-01  8:03 ` [Bug c++/63415] [4.9/5 Regression] " jakub at gcc dot gnu.org
2014-10-09 18:06 ` jason at gcc dot gnu.org
2014-10-10 20:36 ` jason at gcc dot gnu.org
2014-10-15 16:47 ` jason at gcc dot gnu.org
2014-10-15 16:48 ` jason 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).