public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "juchem at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/62274] New: [C++11] Variadic templates expansion into non-variadic class template
Date: Tue, 26 Aug 2014 23:03:00 -0000	[thread overview]
Message-ID: <bug-62274-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2014-08-26 23:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26 23:03 juchem at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-62274-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).