This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51886] New: __alignof__ on uninstantiated template type
- From: "roland at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 17 Jan 2012 18:58:43 +0000
- Subject: [Bug c++/51886] New: __alignof__ on uninstantiated template type
- Auto-submitted: auto-generated
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