aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2014-06-30 15:09:57 -0400
committerJason Merrill <jason@gcc.gnu.org>2014-06-30 15:09:57 -0400
commitf36ae62867b1158b03b2ef7293a87cf9bec3cc14 (patch)
tree26f4ea53ca1ffb5eaa1a1657fc056f05a9db6b6a
parentcae7c96095c645003b25e1b69bee46ade7fce344 (diff)
downloadgcc-f36ae62867b1158b03b2ef7293a87cf9bec3cc14.zip
gcc-f36ae62867b1158b03b2ef7293a87cf9bec3cc14.tar.gz
gcc-f36ae62867b1158b03b2ef7293a87cf9bec3cc14.tar.bz2
re PR c++/61647 (internal compiler error: in push_access_scope, at cp/pt.c:219 for a c++ header, clang++ 3.4 generate .pch without error)
PR c++/61647 * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE. From-SVN: r212168
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/testsuite/g++.dg/template/conv14.C30
3 files changed, 39 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 122cf8a..dba9c55 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2014-06-30 Jason Merrill <jason@redhat.com>
+ PR c++/61647
+ * pt.c (type_dependent_expression_p): Check BASELINK_OPTYPE.
+
PR c++/61566
* mangle.c (decl_mangling_context): Look through a TEMPLATE_DECL.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 70a946c..355b63e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -21089,7 +21089,12 @@ type_dependent_expression_p (tree expression)
return true;
if (BASELINK_P (expression))
- expression = BASELINK_FUNCTIONS (expression);
+ {
+ if (BASELINK_OPTYPE (expression)
+ && dependent_type_p (BASELINK_OPTYPE (expression)))
+ return true;
+ expression = BASELINK_FUNCTIONS (expression);
+ }
if (TREE_CODE (expression) == TEMPLATE_ID_EXPR)
{
diff --git a/gcc/testsuite/g++.dg/template/conv14.C b/gcc/testsuite/g++.dg/template/conv14.C
new file mode 100644
index 0000000..509ae6a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/conv14.C
@@ -0,0 +1,30 @@
+// PR c++/61647
+
+class XX;
+
+template<typename Container, typename Key>
+struct Accessor;
+
+template<typename Container, typename Key, typename KeyStore = Key>
+class Variant {
+protected:
+ KeyStore index;
+ Container state;
+public:
+ Variant(Container st, const Key& i) : index(i), state(st) {}
+
+ template<typename T>
+ operator T() const {
+ return Accessor<Container, KeyStore>::template get<T>(state, index);
+ }
+};
+
+class AutoCleanVariant : public Variant<XX*, int> {
+public:
+ AutoCleanVariant(XX* st, int i) : Variant<XX*,int>(st,i) {}
+
+ template<typename T>
+ operator T() const {
+ return Variant<XX*, int>::operator T();
+ }
+};