public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65498] New: ICE in cxx_eval_call_expression when using __func__ inside dependent context
@ 2015-03-20 18:15 ldionne.2 at gmail dot com
  2015-03-20 18:19 ` [Bug c++/65498] [5 Regression] " paolo.carlini at oracle dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ldionne.2 at gmail dot com @ 2015-03-20 18:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65498
           Summary: ICE in cxx_eval_call_expression when using __func__
                    inside dependent context
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldionne.2 at gmail dot com

The following code triggers an ICE on GCC trunk:
------------------------------------------------------------------------------
    #include <type_traits>

    struct T;

    template <typename, typename = void>
    struct F { };

    template <typename X>
    struct F<X, std::enable_if_t<std::is_same<X, T>{}()>> {
        template <typename MakeDependent>
        F(MakeDependent) {
            auto ICE_HERE = __func__;
            (void)ICE_HERE; // avoid -Wunused-variable
        }
    };

    int main() {
        F<T>{1};
    }
------------------------------------------------------------------------------


Example run:
------------------------------------------------------------------------------
› ~/code/gcc5/bin/g++ -std=c++1y ~/code/hana/test/worksheet.cpp
/Users/ldionne/code/hana/test/worksheet.cpp: In substitution of ‘template<bool
_Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool
_Cond = std::is_same<T, T>{}(); _Tp = void]’:
/Users/ldionne/code/hana/test/worksheet.cpp:1411:25:   required from here
/Users/ldionne/code/hana/test/worksheet.cpp:1408:50:   in constexpr expansion
of ‘((std::integral_constant<bool, true>*)(& std::is_same<T,
T>()))->std::integral_constant<_Tp, __v>::operator()<bool, true>()’
/Users/ldionne/code/hana/test/worksheet.cpp:1411:25: internal compiler error:
in cxx_eval_call_expression, at cp/constexpr.c:1358
         auto ICE_HERE = __func__;
                         ^

/Users/ldionne/code/hana/test/worksheet.cpp:1411:25: internal compiler error:
Abort trap: 6
g++: internal compiler error: Abort trap: 6 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.
------------------------------------------------------------------------------

Note that using 

    std::is_same<X, T>::value

instead of 

    std::is_same<X, T>{}()

seems to fix the issue.


Regards,
Louis Dionne
>From gcc-bugs-return-481008-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Mar 20 18:00:53 2015
Return-Path: <gcc-bugs-return-481008-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17276 invoked by alias); 20 Mar 2015 18:00:52 -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 17253 invoked by uid 48); 20 Mar 2015 18:00:49 -0000
From: "marejde at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/65499] New: Missing "using namespace literals::chrono_literals" in std::chrono
Date: Fri, 20 Mar 2015 18:16:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: marejde 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-65499-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/msg02152.txt.bz2
Content-length: 1448

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

            Bug ID: 65499
           Summary: Missing "using namespace literals::chrono_literals" in
                    std::chrono
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marejde at gmail dot com

Reading http://en.cppreference.com/w/cpp/chrono/operator%22%22min (sorry, I do
not have the spec readily available) it says:

"In addition, within the namespace std::chrono, the directive using namespace
literals::chrono_literals; is provided by the standard library, so that if a
programmer uses using namespace std::chrono; to gain access to the duration
classes, the duration literal operators become visible as well."

The following program:

#include <chrono>
#include <iostream>

int main(void)
{
    using namespace std::chrono;
    minutes min = 36min;
    return 0;
}

Does not compile with GCC 4.9.2 while it does with Clang 3.6.

Looking at GCC trunk as of today I do not see a "using namespace
literals::chrono_literals;" anywhere in libstdc++-v3/include/ . Clang's libc++
has it in the chrono namespace though.

Would be great if this could be fixed before GCC 5.0 is released so I don't
have to sprinkle "using namespace literals::chrono_literals;" in my code to be
able to compile with GCC.


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

end of thread, other threads:[~2015-03-25  8:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20 18:15 [Bug c++/65498] New: ICE in cxx_eval_call_expression when using __func__ inside dependent context ldionne.2 at gmail dot com
2015-03-20 18:19 ` [Bug c++/65498] [5 Regression] " paolo.carlini at oracle dot com
2015-03-20 18:19 ` [Bug c++/65498] " ldionne.2 at gmail dot com
2015-03-20 21:03 ` [Bug c++/65498] [5 Regression] " daniel.kruegler at googlemail dot com
2015-03-22 14:52 ` mpolacek at gcc dot gnu.org
2015-03-22 15:11 ` ldionne.2 at gmail dot com
2015-03-24 13:25 ` mpolacek at gcc dot gnu.org
2015-03-24 15:51 ` mpolacek at gcc dot gnu.org
2015-03-24 17:13 ` jason at gcc dot gnu.org
2015-03-25  8:46 ` mpolacek 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).