public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template
@ 2014-08-26 23:03 juchem at gmail dot com
  2014-12-14  0:04 ` [Bug c++/62274] " ville.voutilainen at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: juchem at gmail dot com @ 2014-08-26 23:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62274
           Summary: [C++11] Variadic templates expansion into non-variadic
                    class template
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: juchem at gmail dot com

The code below won't compile for gcc 4.9.0, 4.8.1 and 4.7.3. Tested in Debian
sid (aug/2014), http://gcc.godbolt.org/ and http://ideone.com.

#include <type_traits>
using namespace std;

struct bar { typedef double foo; };

template <typename T>
using get_foo = typename T::foo;

template <template <typename...> class T>
struct baz {
  template <typename... UArgs>
  using type = T<UArgs...>;
};

int main() {
  return !std::is_same<double, baz<get_foo>::type<bar>>::value;
}

error output:
prog.cpp: In substitution of ‘template<class T> using get_foo = typename T::foo
[with T = UArgs ...]’:
prog.cpp:13:26:   required from ‘struct baz<get_foo>’
prog.cpp:17:49:   required from here
prog.cpp:8:32: error: ‘UArgs ...’ is not a class, struct, or union type
 using get_foo = typename T::foo;
                                ^
prog.cpp: In function ‘int main()’:
prog.cpp:17:59: error: template argument 2 is invalid
  static_assert(std::is_same<double, baz<get_foo>::type<bar>>::value,
"mismatch");
>From gcc-bugs-return-459316-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Aug 26 23:07:34 2014
Return-Path: <gcc-bugs-return-459316-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 17161 invoked by alias); 26 Aug 2014 23:07:34 -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 17126 invoked by uid 48); 26 Aug 2014 23:07:30 -0000
From: "pinskia at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/62262] aarch64 gcc generates invalid assembler
Date: Tue, 26 Aug 2014 23:07:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
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: pinskia at gcc dot gnu.org
X-Bugzilla-Status: NEW
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:
Message-ID: <bug-62262-4-K5eOX949Y4@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-62262-4@http.gcc.gnu.org/bugzilla/>
References: <bug-62262-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-08/txt/msg01813.txt.bz2
Content-length: 499

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Carrot from comment #5)
> Actually the original source code is guarded by assert, and the parameter
> passed to CLZ can be guaranteed not 0, so "value <<= zeros" is well defined
> in our original source code.

The issue is the second CLZ (not the first one).  Though if I read the code
correctly value<<1 can never be zero but GCC does not optimize away that check.


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

* [Bug c++/62274] [C++11] Variadic templates expansion into non-variadic class template
  2014-08-26 23:03 [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template juchem at gmail dot com
@ 2014-12-14  0:04 ` ville.voutilainen at gmail dot com
  2015-03-05  7:26 ` juchem at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ville.voutilainen at gmail dot com @ 2014-12-14  0:04 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ville.voutilainen at gmail dot com

--- Comment #2 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
Clang doesn't accept the code either. The technique looks reasonable, the
validity of this should probably be queried from CWG.


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

* [Bug c++/62274] [C++11] Variadic templates expansion into non-variadic class template
  2014-08-26 23:03 [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template juchem at gmail dot com
  2014-12-14  0:04 ` [Bug c++/62274] " ville.voutilainen at gmail dot com
@ 2015-03-05  7:26 ` juchem at gmail dot com
  2015-03-05  7:50 ` ville.voutilainen at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: juchem at gmail dot com @ 2015-03-05  7:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from juchem at gmail dot com ---
Clang does accept this code: http://goo.gl/YKBt2l


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

* [Bug c++/62274] [C++11] Variadic templates expansion into non-variadic class template
  2014-08-26 23:03 [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template juchem at gmail dot com
  2014-12-14  0:04 ` [Bug c++/62274] " ville.voutilainen at gmail dot com
  2015-03-05  7:26 ` juchem at gmail dot com
@ 2015-03-05  7:50 ` ville.voutilainen at gmail dot com
  2015-03-05 10:48 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-03-05  7:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
(In reply to juchem from comment #3)
> Clang does accept this code: http://goo.gl/YKBt2l

Clang 3.3 and 3.4 do, yes. 3.5, 3.6 and their trunk don't.


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

* [Bug c++/62274] [C++11] Variadic templates expansion into non-variadic class template
  2014-08-26 23:03 [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template juchem at gmail dot com
                   ` (2 preceding siblings ...)
  2015-03-05  7:50 ` ville.voutilainen at gmail dot com
@ 2015-03-05 10:48 ` redi at gcc dot gnu.org
  2021-08-02  2:21 ` pinskia at gcc dot gnu.org
  2021-08-02  3:59 ` ville.voutilainen at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-05 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
EDG accepts it.


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

* [Bug c++/62274] [C++11] Variadic templates expansion into non-variadic class template
  2014-08-26 23:03 [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template juchem at gmail dot com
                   ` (3 preceding siblings ...)
  2015-03-05 10:48 ` redi at gcc dot gnu.org
@ 2021-08-02  2:21 ` pinskia at gcc dot gnu.org
  2021-08-02  3:59 ` ville.voutilainen at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-02  2:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC, clang and MSVC all reject it with a similar error message.
ICC accepts it.

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

* [Bug c++/62274] [C++11] Variadic templates expansion into non-variadic class template
  2014-08-26 23:03 [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template juchem at gmail dot com
                   ` (4 preceding siblings ...)
  2021-08-02  2:21 ` pinskia at gcc dot gnu.org
@ 2021-08-02  3:59 ` ville.voutilainen at gmail dot com
  5 siblings, 0 replies; 7+ messages in thread
From: ville.voutilainen at gmail dot com @ 2021-08-02  3:59 UTC (permalink / raw)
  To: gcc-bugs

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

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at redhat dot com

--- Comment #7 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
I think this may be subject to various Core discussions. Jason?

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

end of thread, other threads:[~2021-08-02  3:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-26 23:03 [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template juchem at gmail dot com
2014-12-14  0:04 ` [Bug c++/62274] " ville.voutilainen at gmail dot com
2015-03-05  7:26 ` juchem at gmail dot com
2015-03-05  7:50 ` ville.voutilainen at gmail dot com
2015-03-05 10:48 ` redi at gcc dot gnu.org
2021-08-02  2:21 ` pinskia at gcc dot gnu.org
2021-08-02  3:59 ` ville.voutilainen at gmail dot com

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).