[cfe-commits] r164437 - in /cfe/trunk: include/clang/Basic/Diagnostic.h test/SemaTemplate/instantiate-exception-spec-cxx11.cpp test/SemaTemplate/instantiation-depth-exception-spec.cpp test/SemaTemplate/instantiation-depth-subst-2.cpp test/SemaTemplate/instantiation-depth-subst.cpp
Richard Smith
richard-llvm at metafoo.co.uk
Fri Sep 21 17:53:56 PDT 2012
Author: rsmith
Date: Fri Sep 21 19:53:56 2012
New Revision: 164437
URL: http://llvm.org/viewvc/llvm-project?rev=164437&view=rev
Log:
Fix bug which sometimes resulted in further diagnostics being produced after a
fatal error. Previously, if a fatal error was followed by a diagnostic which
was suppressed due to a SFINAETrap, we'd forget that we'd seen a fatal error.
Added:
cfe/trunk/test/SemaTemplate/instantiation-depth-exception-spec.cpp
Modified:
cfe/trunk/include/clang/Basic/Diagnostic.h
cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
cfe/trunk/test/SemaTemplate/instantiation-depth-subst-2.cpp
cfe/trunk/test/SemaTemplate/instantiation-depth-subst.cpp
Modified: cfe/trunk/include/clang/Basic/Diagnostic.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.h?rev=164437&r1=164436&r2=164437&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Diagnostic.h (original)
+++ cfe/trunk/include/clang/Basic/Diagnostic.h Fri Sep 21 19:53:56 2012
@@ -478,10 +478,13 @@
}
OverloadsShown getShowOverloads() const { return ShowOverloads; }
- /// \brief Pretend that the last diagnostic issued was ignored.
+ /// \brief Pretend that the last diagnostic issued was ignored, so any
+ /// subsequent notes will be suppressed.
///
/// This can be used by clients who suppress diagnostics themselves.
void setLastDiagnosticIgnored() {
+ if (LastDiagLevel == DiagnosticIDs::Fatal)
+ FatalErrorOccurred = true;
LastDiagLevel = DiagnosticIDs::Ignored;
}
Modified: cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp?rev=164437&r1=164436&r2=164437&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp Fri Sep 21 19:53:56 2012
@@ -34,18 +34,6 @@
void (*pFn2)() noexcept = &S<0>::recurse; // expected-note {{instantiation of exception spec}} expected-error {{not superset}}
-template<typename T> T go(T a) noexcept(noexcept(go(a))); // \
-// expected-error 16{{call to function 'go' that is neither visible}} \
-// expected-note 16{{'go' should be declared prior to the call site}} \
-// expected-error {{recursive template instantiation exceeded maximum depth of 16}} \
-// expected-error {{use of undeclared identifier 'go'}} \
-
-void f() {
- int k = go(0); // \
- // expected-note {{in instantiation of exception specification for 'go<int>' requested here}}
-}
-
-
namespace dr1330_example {
template <class T> struct A {
void f(...) throw (typename T::X); // expected-error {{'int'}}
Added: cfe/trunk/test/SemaTemplate/instantiation-depth-exception-spec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiation-depth-exception-spec.cpp?rev=164437&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiation-depth-exception-spec.cpp (added)
+++ cfe/trunk/test/SemaTemplate/instantiation-depth-exception-spec.cpp Fri Sep 21 19:53:56 2012
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -ftemplate-depth 16 -fcxx-exceptions -fexceptions %s
+
+template<typename T> T go(T a) noexcept(noexcept(go(a))); // \
+// expected-error 16{{call to function 'go' that is neither visible}} \
+// expected-note 16{{'go' should be declared prior to the call site}} \
+// expected-error {{recursive template instantiation exceeded maximum depth of 16}}
+
+void f() {
+ int k = go(0); // \
+ // expected-note {{in instantiation of exception specification for 'go<int>' requested here}}
+}
Modified: cfe/trunk/test/SemaTemplate/instantiation-depth-subst-2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiation-depth-subst-2.cpp?rev=164437&r1=164436&r2=164437&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiation-depth-subst-2.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiation-depth-subst-2.cpp Fri Sep 21 19:53:56 2012
@@ -1,9 +1,6 @@
// RUN: %clang_cc1 -verify %s -ftemplate-depth 2
template<int N> struct S { };
-// FIXME: We produce the same 'instantiation depth' error here many times
-// (2^(depth+1) in total), due to additional lookups performed as part of
-// error recovery in DiagnoseTwoPhaseOperatorLookup.
-template<typename T> S<T() + T()> operator+(T, T); // expected-error 8{{}} expected-note 10{{}}
+template<typename T> S<T() + T()> operator+(T, T); // expected-error {{instantiation exceeded maximum depth}} expected-note 3{{while substituting}}
S<0> s;
-int k = s + s; // expected-error {{invalid operands to binary expression}}
+int k = s + s;
Modified: cfe/trunk/test/SemaTemplate/instantiation-depth-subst.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiation-depth-subst.cpp?rev=164437&r1=164436&r2=164437&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiation-depth-subst.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiation-depth-subst.cpp Fri Sep 21 19:53:56 2012
@@ -3,7 +3,7 @@
// PR9793
template<typename T> auto f(T t) -> decltype(f(t)); // \
// expected-error {{recursive template instantiation exceeded maximum depth of 2}} \
-// expected-note 3 {{while substituting}} \
-// expected-note {{candidate}}
+// expected-note 3 {{while substituting}}
-int k = f(0); // expected-error {{no matching function for call to 'f'}}
+struct S {};
+int k = f(S{});
More information about the cfe-commits
mailing list