diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-12-31 12:46:18 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-12-31 12:46:18 +0100 |
commit | cc81fd182879509b81a950dd586f8269c970502f (patch) | |
tree | c51d8d1cc8c676c3d17bb9a2e900b434bb415c18 /gcc/testsuite/g++.dg | |
parent | a67d93194a23a00de6c09821fe8fd6c31ac2fd9e (diff) | |
download | gcc-cc81fd182879509b81a950dd586f8269c970502f.zip gcc-cc81fd182879509b81a950dd586f8269c970502f.tar.gz gcc-cc81fd182879509b81a950dd586f8269c970502f.tar.bz2 |
re PR c++/38647 (ICE using __FUNCTION__ as template parameter)
PR c++/38647
* parser.c (cp_parser_primary_expression) <case RID_FUNCTION_NAME>:
Return error_mark_node if cp_parser_non_integral_constant_expression
returns true.
* g++.dg/template/function1.C: New test.
From-SVN: r142978
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/template/function1.C | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/template/function1.C b/gcc/testsuite/g++.dg/template/function1.C new file mode 100644 index 0000000..1097c5b --- /dev/null +++ b/gcc/testsuite/g++.dg/template/function1.C @@ -0,0 +1,27 @@ +// PR c++/38647 +// { dg-do compile } + +template<const char *, int> struct A {}; +const char func[] = "abc"; +template<int N> struct A<func, N> {}; // { dg-error "cannot appear|is invalid" } + +char a1[1]; +A<a1, 0> a; + +template<const char *, int> struct B {}; +template<int N> struct B<__FUNCTION__, N> {}; // { dg-error "cannot appear|is invalid" } + +char b1[1]; +B<b1, 0> b; + +template<const char *, int> struct C {}; +template<int N> struct C<__PRETTY_FUNCTION__, N> {}; // { dg-error "cannot appear|is invalid" } + +char c1[1]; +C<c1, 0> c; + +template<const char *, int> struct D {}; +template<int N> struct D<__func__, N> {}; // { dg-error "cannot appear|is invalid" } + +char d1[1]; +D<d1, 0> d; |