From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5713 invoked by alias); 17 Jan 2012 18:59:18 -0000 Received: (qmail 5694 invoked by uid 22791); 17 Jan 2012 18:59:14 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 17 Jan 2012 18:59:01 +0000 From: "roland at gnu dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/51886] New: __alignof__ on uninstantiated template type Date: Tue, 17 Jan 2012 20:01:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: roland at gnu dot 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-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-01/txt/msg01940.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51886 Bug #: 51886 Summary: __alignof__ on uninstantiated template type Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: roland@gnu.org The attached test case shows a bug when applying __alignof__ to a type that is part of a template instantiation that has not otherwise been instantiated. I noticed this on 4.4.3 but reproduced it on today's trunk (r183254). This case needs to be compiled with -std=c++0x just because it uses static_assert. As the comment in the case indicates, simply doing an unrelated instantiation of the template before the __alignof__ expression is evaluated makes the problem disappear. % gcc/g++ -Bgcc/ -S -o - -std=c++0x /tmp/template-align.cc .file "template-align.cc" /tmp/template-align.cc:9:1: error: static assertion failed: misaligned