diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-03 17:24:46 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-03 17:24:46 +0000 |
commit | 3e954caa73673a2ea3c9bff5b049cfa0de939127 (patch) | |
tree | 33275fd3bd5b3964a1bbd9b544aa176572a87fce /gcc/testsuite | |
parent | 5270995ac4219ba92bfef2f51088ba5c78e61aa3 (diff) | |
download | gcc-3e954caa73673a2ea3c9bff5b049cfa0de939127.tar.gz |
PR c++/39608
* semantics.c (finish_id_expression): Don't assume a dependent
member of the current instantiation isn't a valid integral
constant expression. Check dependent_scope_p.
* pt.c (dependent_scope_p): Check TYPE_P.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145508 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/const2.C | 16 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ded87d66bda..2d697b1ea97 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-04-03 Jason Merrill <jason@redhat.com> + + PR c++/39608 + * g++.dg/template/const2.C: New test. + 2009-04-03 Richard Guenther <rguenther@suse.de> PR tree-optimization/2480 diff --git a/gcc/testsuite/g++.dg/template/const2.C b/gcc/testsuite/g++.dg/template/const2.C new file mode 100644 index 00000000000..5188fe29d10 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/const2.C @@ -0,0 +1,16 @@ +// PR c++/39608 +// We were improperly considering dependent members of the current +// instantiation to be non-constant (and therefore invalid template +// non-type arguments). + +template <int I> +struct C {}; + +template <class T> +struct A +{ + static const T x = 1; + C<A<T>::x> c; // { dg-bogus "invalid" } +}; + +A<int> a; |