* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@234436
138bc75d-0d04-0410-961f-
82ee72b054a4
+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
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);
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
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);
/* 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;
}
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
+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
--- /dev/null
+// 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;
+}
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 ...))