re PR c++/69315 (ICE in finish_function with constexpr and templates)
PR c++/69315 * cp-tree.h (defer_mark_used_calls, deferred_mark_used_calls): Remove. * decl.c (defer_mark_used_calls, deferred_mark_used_calls): Remove. (finish_function): Don't set or test them. * decl2.c (mark_used): Don't handle defer_mark_used_calls. * g++.dg/cpp0x/constexpr-69315.C: New test. * g++.dg/cpp0x/variadic122.C: Change one dg-warning into dg-bogus. Co-Authored-By: Jakub Jelinek <jakub@redhat.com> Co-Authored-By: Jason Merrill <jason@redhat.com> From-SVN: r234436
This commit is contained in:
parent
96a4ef9d6a
commit
05aca4e73c
@ -1,3 +1,13 @@
|
||||
2016-03-23 Alexandre Oliva <aoliva@redhat.com>
|
||||
Jason Merrill <jason@redhat.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/69315
|
||||
* cp-tree.h (defer_mark_used_calls, deferred_mark_used_calls): Remove.
|
||||
* decl.c (defer_mark_used_calls, deferred_mark_used_calls): Remove.
|
||||
(finish_function): Don't set or test them.
|
||||
* decl2.c (mark_used): Don't handle defer_mark_used_calls.
|
||||
|
||||
2016-03-23 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/70344
|
||||
|
@ -5846,8 +5846,6 @@ extern tree fndecl_declared_return_type (tree);
|
||||
extern bool undeduced_auto_decl (tree);
|
||||
extern void require_deduced_type (tree);
|
||||
|
||||
extern bool defer_mark_used_calls;
|
||||
extern GTY(()) vec<tree, va_gc> *deferred_mark_used_calls;
|
||||
extern tree finish_case_label (location_t, tree, tree);
|
||||
extern tree cxx_maybe_build_cleanup (tree, tsubst_flags_t);
|
||||
|
||||
|
@ -227,11 +227,6 @@ struct GTY((for_user)) named_label_entry {
|
||||
function, two inside the body of a function in a local class, etc.) */
|
||||
int function_depth;
|
||||
|
||||
/* To avoid unwanted recursion, finish_function defers all mark_used calls
|
||||
encountered during its execution until it finishes. */
|
||||
bool defer_mark_used_calls;
|
||||
vec<tree, va_gc> *deferred_mark_used_calls;
|
||||
|
||||
/* States indicating how grokdeclarator() should handle declspecs marked
|
||||
with __attribute__((deprecated)). An object declared as
|
||||
__attribute__((deprecated)) suppresses warnings of uses of other
|
||||
@ -14594,9 +14589,6 @@ finish_function (int flags)
|
||||
if (c_dialect_objc ())
|
||||
objc_finish_function ();
|
||||
|
||||
gcc_assert (!defer_mark_used_calls);
|
||||
defer_mark_used_calls = true;
|
||||
|
||||
record_key_method_defined (fndecl);
|
||||
|
||||
fntype = TREE_TYPE (fndecl);
|
||||
@ -14846,17 +14838,6 @@ finish_function (int flags)
|
||||
/* Clean up. */
|
||||
current_function_decl = NULL_TREE;
|
||||
|
||||
defer_mark_used_calls = false;
|
||||
if (deferred_mark_used_calls)
|
||||
{
|
||||
unsigned int i;
|
||||
tree decl;
|
||||
|
||||
FOR_EACH_VEC_SAFE_ELT (deferred_mark_used_calls, i, decl)
|
||||
mark_used (decl);
|
||||
vec_free (deferred_mark_used_calls);
|
||||
}
|
||||
|
||||
invoke_plugin_callbacks (PLUGIN_FINISH_PARSE_FUNCTION, fndecl);
|
||||
return fndecl;
|
||||
}
|
||||
|
@ -5140,14 +5140,6 @@ mark_used (tree decl, tsubst_flags_t complain)
|
||||
if (DECL_ODR_USED (decl))
|
||||
return true;
|
||||
|
||||
/* If within finish_function, defer the rest until that function
|
||||
finishes, otherwise it might recurse. */
|
||||
if (defer_mark_used_calls)
|
||||
{
|
||||
vec_safe_push (deferred_mark_used_calls, decl);
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Normally, we can wait until instantiation-time to synthesize DECL.
|
||||
However, if DECL is a static data member initialized with a constant
|
||||
or a constexpr function, we need it right now because a reference to
|
||||
|
@ -1,3 +1,11 @@
|
||||
2016-03-23 Alexandre Oliva <aoliva@redhat.com>
|
||||
Jason Merrill <jason@redhat.com>
|
||||
Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/69315
|
||||
* g++.dg/cpp0x/constexpr-69315.C: New test.
|
||||
* g++.dg/cpp0x/variadic122.C: Change one dg-warning into dg-bogus.
|
||||
|
||||
2016-03-23 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/69884
|
||||
|
35
gcc/testsuite/g++.dg/cpp0x/constexpr-69315.C
Normal file
35
gcc/testsuite/g++.dg/cpp0x/constexpr-69315.C
Normal file
@ -0,0 +1,35 @@
|
||||
// PR c++/69315
|
||||
// { dg-do compile { target c++11 } }
|
||||
// { dg-options "-O2" }
|
||||
|
||||
// Template instantiation and evaluation for folding within
|
||||
// finish_function may call finish_function recursively.
|
||||
// Make sure we don't reject or delay that sort of recursion.
|
||||
|
||||
template <bool> struct Iter;
|
||||
|
||||
struct Arg {
|
||||
Iter<true> begin();
|
||||
Iter<true> end();
|
||||
};
|
||||
|
||||
template <bool> struct Iter {
|
||||
int operator*();
|
||||
Iter operator++();
|
||||
template <bool C1, bool C2> friend constexpr bool operator==(Iter<C1>, Iter<C2>);
|
||||
template <bool C1, bool C2> friend constexpr bool operator!=(Iter<C1>, Iter<C2>);
|
||||
};
|
||||
|
||||
void func(Arg a) {
|
||||
for (auto ch : a) {
|
||||
a.begin() == a.end();
|
||||
}
|
||||
}
|
||||
|
||||
template <bool C1, bool C2> constexpr bool operator==(Iter<C1>, Iter<C2>) {
|
||||
return true;
|
||||
}
|
||||
|
||||
template <bool C1, bool C2> constexpr bool operator!=(Iter<C1> a, Iter<C2> b) {
|
||||
return a == b;
|
||||
}
|
@ -9,7 +9,7 @@ template < class T > struct Container
|
||||
|
||||
template < class T >
|
||||
T deref (T)
|
||||
{} // { dg-warning "no return" }
|
||||
{} // { dg-bogus "no return" }
|
||||
|
||||
template < class T, class ... Args >
|
||||
auto deref (T u, int, Args ... args)->decltype (deref (u.f (), args ...))
|
||||
|
Loading…
Reference in New Issue
Block a user