forked from iains/gcc-14-branch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c++: sizeof... mangling with alias template [PR95298]
We were getting sizeof... mangling wrong when the argument after substitution was a pack expansion that is not a simple T..., such as list<T>... in variadic-mangle4.C or (A+1)... in variadic-mangle5.C. In the former case we ICEd; in the latter case we wrongly mangled it as sZ <expression>. PR c++/95298 gcc/cp/ChangeLog: * mangle.cc (write_expression): Handle v18 sizeof... bug. * pt.cc (tsubst_pack_expansion): Keep TREE_VEC for sizeof... (tsubst_expr): Don't strip TREE_VEC here. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/variadic-mangle2.C: Add non-member. * g++.dg/cpp0x/variadic-mangle4.C: New test. * g++.dg/cpp0x/variadic-mangle5.C: New test. * g++.dg/cpp0x/variadic-mangle5a.C: New test.
- Loading branch information
Showing
6 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// PR c++/95298 | ||
// { dg-do compile { target c++11 } } | ||
// { dg-additional-options -fabi-compat-version=0 } | ||
|
||
template<class...> | ||
struct list{}; | ||
|
||
template<int n> | ||
struct _func_select | ||
{ | ||
using f = void; | ||
}; | ||
|
||
struct func | ||
{ | ||
template<class... seqs> | ||
using f = typename _func_select<sizeof...(seqs)>::f; | ||
}; | ||
|
||
template<class... T> | ||
func::f<list<T>...> foo(T&&...) | ||
{} | ||
|
||
// { dg-final { scan-assembler "_Z3fooIJEEN12_func_selectIXsPDp4listIJT_EEEEE1fEDpOS2_" } } | ||
|
||
int main() | ||
{ | ||
foo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// { dg-do compile { target c++11 } } | ||
// { dg-additional-options "-fabi-version=0 -fabi-compat-version=0" } | ||
|
||
template<int...T> using N = int[sizeof...(T)]; | ||
template<int...A> void f(N<(A+1)...> &); | ||
|
||
void g() | ||
{ | ||
int arr[3]; | ||
|
||
// { dg-final { scan-assembler "_Z1fIJLi1ELi2ELi3EEEvRAsPXspplT_Li1EEE_i" } } | ||
f<1,2,3>(arr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// { dg-do compile { target c++11 } } | ||
// { dg-additional-options "-fabi-version=18 -fabi-compat-version=18" } | ||
|
||
template<int...T> using N = int[sizeof...(T)]; | ||
template<int...A> void f(N<(A+1)...> &); | ||
|
||
void g() | ||
{ | ||
int arr[3]; | ||
|
||
// { dg-final { scan-assembler "_Z1fIJLi1ELi2ELi3EEEvRAsZplT_Li1E_i" } } | ||
f<1,2,3>(arr); | ||
} |