diff options
author | Jason Merrill <jason@redhat.com> | 2008-02-12 01:34:59 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2008-02-12 01:34:59 -0500 |
commit | 02e52ae514072eb565ae9d7451ee00756c4f5121 (patch) | |
tree | 5da1929b3e695664f9c78e4199a4f96852b8ce4c /gcc | |
parent | d6f77715ea2c787e01a4cd67fc3554b043abe2b2 (diff) | |
download | gcc-02e52ae514072eb565ae9d7451ee00756c4f5121.zip gcc-02e52ae514072eb565ae9d7451ee00756c4f5121.tar.gz gcc-02e52ae514072eb565ae9d7451ee00756c4f5121.tar.bz2 |
re PR c++/35097 (ICE with attribute and template specialization)
PR c++/35097
* pt.c (tsubst): Don't look up a template typedef in an explicit
specialization.
From-SVN: r132253
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/attrib31.C | 15 |
3 files changed, 25 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1e26a16..c11dcd5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2008-02-11 Jason Merrill <jason@redhat.com> + + PR c++/35097 + * pt.c (tsubst): Don't look up a template typedef in an explicit + specialization. + 2008-02-11 Douglas Gregor <doug.gregor@gmail.com> PR c++/35113 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2a8296e..a1e6521 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8826,14 +8826,16 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) tree decl = TYPE_NAME (t); if (DECL_CLASS_SCOPE_P (decl) - && CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl))) + && CLASSTYPE_TEMPLATE_INFO (DECL_CONTEXT (decl)) + && uses_template_parms (DECL_CONTEXT (decl))) { tree tmpl = most_general_template (DECL_TI_TEMPLATE (decl)); tree gen_args = tsubst (DECL_TI_ARGS (decl), args, complain, in_decl); r = retrieve_specialization (tmpl, gen_args, false); } else if (DECL_FUNCTION_SCOPE_P (decl) - && DECL_TEMPLATE_INFO (DECL_CONTEXT (decl))) + && DECL_TEMPLATE_INFO (DECL_CONTEXT (decl)) + && uses_template_parms (DECL_TI_ARGS (DECL_CONTEXT (decl)))) r = retrieve_local_specialization (decl); else /* The typedef is from a non-template context. */ diff --git a/gcc/testsuite/g++.dg/ext/attrib31.C b/gcc/testsuite/g++.dg/ext/attrib31.C new file mode 100644 index 0000000..c614ed4 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/attrib31.C @@ -0,0 +1,15 @@ +// PR c++/35097 + +template<int> struct A; + +template<> struct A<0> +{ + typedef int X __attribute((aligned(4))); +}; + +template<typename T> void foo(const A<0>::X&, T); + +void bar() +{ + foo(A<0>::X(), 0); +} |