public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64455] New: A constexpr variable template can't be used with enable_if
@ 2014-12-31 13:39 ville.voutilainen at gmail dot com
2015-01-01 16:33 ` [Bug c++/64455] " ville.voutilainen at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-31 13:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64455
Bug ID: 64455
Summary: A constexpr variable template can't be used with
enable_if
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ville.voutilainen at gmail dot com
CC: jason at redhat dot com
#include <type_traits>
template<typename Type>
constexpr bool IsType = true;
template<class T>
struct X {
typedef typename std::enable_if<IsType<T>,T>::type type;
};
int main()
{
X<int>::type t;
}
dionne.cpp:8:37: error: the value of ‘IsType<T>’ is not usable in a constant
expression
typedef typename std::enable_if<IsType<T>,T>::type type;
^
dionne.cpp:4:16: note: ‘IsType<T>’ used in its own initializer
constexpr bool IsType = true;
^
dionne.cpp:8:48: error: the value of ‘IsType<T>’ is not usable in a constant
expression
typedef typename std::enable_if<IsType<T>,T>::type type;
^
dionne.cpp:4:16: note: ‘IsType<T>’ used in its own initializer
constexpr bool IsType = true;
^
dionne.cpp:8:48: note: in template argument for type ‘bool’
typedef typename std::enable_if<IsType<T>,T>::type type;
^
Clang accepts the code.
>From gcc-bugs-return-471991-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Wed Dec 31 13:43:33 2014
Return-Path: <gcc-bugs-return-471991-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 2872 invoked by alias); 31 Dec 2014 13:43:33 -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 2851 invoked by uid 48); 31 Dec 2014 13:43:29 -0000
From: "belagod at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64456] New: [AArch64] pr64252.c fail on aarch64_be
Date: Wed, 31 Dec 2014 13:43:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: belagod at gcc dot gnu.org
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-64456-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-12/txt/msg02998.txt.bz2
Content-length: 800
https://gcc.gnu.org/bugzilla/show_bug.cgi?idd456
Bug ID: 64456
Summary: [AArch64] pr64252.c fail on aarch64_be
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: belagod at gcc dot gnu.org
This new test fails for BE:
FAIL: gcc.dg/vect/pr64252.c -flto -ffat-lto-objects execution test
FAIL: gcc.dg/vect/pr64252.c execution test
but it is fixed by this patch series:
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg01431.html
https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01099.html
https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02797.html
https://gcc.gnu.org/ml/gcc-patches/2014-12/msg01087.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64455] A constexpr variable template can't be used with enable_if
2014-12-31 13:39 [Bug c++/64455] New: A constexpr variable template can't be used with enable_if ville.voutilainen at gmail dot com
@ 2015-01-01 16:33 ` ville.voutilainen at gmail dot com
2015-01-02 10:09 ` ville.voutilainen at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-01 16:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64455
--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Btw, this problem prevents using the C++14 trait aliases with the forthcoming
trait variable templates as they were intended, because
template <class T> enable_if_t<is_same_v<T, int>> f() {}
is also erroneously rejected with the diagnostic that is_same_v<T, int>
is not usable in a constant expression.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64455] A constexpr variable template can't be used with enable_if
2014-12-31 13:39 [Bug c++/64455] New: A constexpr variable template can't be used with enable_if ville.voutilainen at gmail dot com
2015-01-01 16:33 ` [Bug c++/64455] " ville.voutilainen at gmail dot com
@ 2015-01-02 10:09 ` ville.voutilainen at gmail dot com
2015-01-06 20:45 ` jason at gcc dot gnu.org
2015-01-06 22:11 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-01-02 10:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64455
--- Comment #2 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Reduced to avoid using type_traits:
template<typename Type>
constexpr bool IsType = true;
template <bool b, class T> struct Test
{
};
template <class T>
struct Test<true, T>
{
typedef T type;
};
template<class T>
struct X {
typedef typename Test<IsType<T>,T>::type type;
};
int main()
{
X<int>::type t;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64455] A constexpr variable template can't be used with enable_if
2014-12-31 13:39 [Bug c++/64455] New: A constexpr variable template can't be used with enable_if ville.voutilainen at gmail dot com
2015-01-01 16:33 ` [Bug c++/64455] " ville.voutilainen at gmail dot com
2015-01-02 10:09 ` ville.voutilainen at gmail dot com
@ 2015-01-06 20:45 ` jason at gcc dot gnu.org
2015-01-06 22:11 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-06 20:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64455
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Author: jason
Date: Tue Jan 6 20:44:51 2015
New Revision: 219268
URL: https://gcc.gnu.org/viewcvs?rev=219268&root=gcc&view=rev
Log:
PR c++/64455
* pt.c (type_dependent_expression_p): Handle variable templates.
* constexpr.c (potential_constant_expression_1): Use it.
Added:
trunk/gcc/testsuite/g++.dg/cpp1y/var-templ21.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/constexpr.c
trunk/gcc/cp/pt.c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/64455] A constexpr variable template can't be used with enable_if
2014-12-31 13:39 [Bug c++/64455] New: A constexpr variable template can't be used with enable_if ville.voutilainen at gmail dot com
` (2 preceding siblings ...)
2015-01-06 20:45 ` jason at gcc dot gnu.org
@ 2015-01-06 22:11 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2015-01-06 22:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64455
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |jason at gcc dot gnu.org
Resolution|--- |FIXED
Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org
--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-06 22:11 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-31 13:39 [Bug c++/64455] New: A constexpr variable template can't be used with enable_if ville.voutilainen at gmail dot com
2015-01-01 16:33 ` [Bug c++/64455] " ville.voutilainen at gmail dot com
2015-01-02 10:09 ` ville.voutilainen at gmail dot com
2015-01-06 20:45 ` jason at gcc dot gnu.org
2015-01-06 22:11 ` 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).