Bug 59012 - alignas does not support parameter pack expansions
Summary: alignas does not support parameter pack expansions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 5.2
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
: 62136 (view as bug list)
Depends on:
Blocks: 58601
  Show dependency treegraph
 
Reported: 2013-11-05 19:32 UTC by Jonathan Wakely
Modified: 2021-09-20 22:00 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-11-06 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2013-11-05 19:32:17 UTC
template<unsigned N, typename... T>
struct aligned_union
{
  alignas(T...) char data[N];
};

int main()
{
  aligned_union<8, double> a;
}
Comment 1 Jonathan Wakely 2013-11-05 19:41:05 UTC
a.cc:4:12: error: expected ‘)’ before ‘...’ token
   alignas(T...) char data[N];
            ^
a.cc:4:12: error: expected ‘)’ before ‘...’ token
a.cc:4:12: error: expected unqualified-id before ‘...’ token
Comment 2 Paolo Carlini 2013-11-06 00:22:29 UTC
Looks like quite a bit is unimplemented about this, both in the parser and in pt.c. I mean to have a look.
Comment 3 Jonathan Wakely 2014-08-14 17:32:44 UTC
*** Bug 62136 has been marked as a duplicate of this bug. ***
Comment 4 Jason Merrill 2015-05-08 04:42:38 UTC
Author: jason
Date: Fri May  8 04:42:06 2015
New Revision: 222902

URL: https://gcc.gnu.org/viewcvs?rev=222902&root=gcc&view=rev
Log:
	PR c++/59012
	* parser.c (cp_parser_std_attribute_list): Handle attribute expansion.
	(cp_parser_std_attribute_spec): Handle alignas pack expansion.
	* decl2.c (is_late_template_attribute): An attribute exp is dependent.
	* pt.c (make_pack_expansion): Allow TREE_LIST for attribute expansion.
	(apply_late_template_attributes): Handle attribute pack expansion.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/alignas4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/cp/parser.c
    trunk/gcc/cp/pt.c
Comment 5 Jason Merrill 2015-05-08 21:15:53 UTC
Author: jason
Date: Fri May  8 21:15:21 2015
New Revision: 222927

URL: https://gcc.gnu.org/viewcvs?rev=222927&root=gcc&view=rev
Log:
	PR c++/59012
	* parser.c (cp_parser_std_attribute_list): Handle attribute expansion.
	(cp_parser_std_attribute_spec): Handle alignas pack expansion.
	* decl2.c (is_late_template_attribute): An attribute exp is dependent.
	* pt.c (make_pack_expansion): Allow TREE_LIST for attribute expansion.
	(apply_late_template_attributes): Handle attribute pack expansion.

Added:
    branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp0x/alignas4.C
Modified:
    branches/gcc-5-branch/gcc/cp/ChangeLog
    branches/gcc-5-branch/gcc/cp/decl2.c
    branches/gcc-5-branch/gcc/cp/parser.c
    branches/gcc-5-branch/gcc/cp/pt.c
Comment 6 Martin Sebor 2016-01-23 17:05:05 UTC
Fixed on trunk by r222902 and bacported to 5.x branch in r222927.