r185887 - Fix crash typo-correcting dependent member func.

Eli Friedman eli.friedman at gmail.com
Mon Jul 8 16:35:04 PDT 2013


Author: efriedma
Date: Mon Jul  8 18:35:04 2013
New Revision: 185887

URL: http://llvm.org/viewvc/llvm-project?rev=185887&view=rev
Log:
Fix crash typo-correcting dependent member func.

PR16561.

Modified:
    cfe/trunk/lib/Sema/Sema.cpp
    cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp

Modified: cfe/trunk/lib/Sema/Sema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.cpp?rev=185887&r1=185886&r2=185887&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.cpp (original)
+++ cfe/trunk/lib/Sema/Sema.cpp Mon Jul  8 18:35:04 2013
@@ -1187,7 +1187,7 @@ bool Sema::tryExprAsCall(Expr &E, QualTy
   // Attempt to call the member with no arguments - this will correctly handle
   // member templates with defaults/deduction of template arguments, overloads
   // with default arguments, etc.
-  if (IsMemExpr) {
+  if (IsMemExpr && !E.isTypeDependent()) {
     bool Suppress = getDiagnostics().getSuppressAllDiagnostics();
     getDiagnostics().setSuppressAllDiagnostics(true);
     ExprResult R = BuildCallToMemberFunction(NULL, &E, SourceLocation(), None,

Modified: cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp?rev=185887&r1=185886&r2=185887&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp (original)
+++ cfe/trunk/test/SemaCXX/addr-of-overloaded-function.cpp Mon Jul  8 18:35:04 2013
@@ -235,3 +235,7 @@ namespace test1 {
 
   void (Qualifiers::*X)() = &Dummy::N; // expected-error{{cannot initialize a variable of type 'void (test1::Qualifiers::*)()' with an rvalue of type 'void (test1::Dummy::*)()': different classes ('test1::Qualifiers' vs 'test1::Dummy')}}
 }
+
+template <typename T> class PR16561 {
+  virtual bool f() { if (f) {} return false; } // expected-error {{reference to non-static member function must be called}}
+};





More information about the cfe-commits mailing list