Fix gcc ambiguity error (Visual C++ was OK with these).
authorYaron Keren <yaron.keren@gmail.com>
Wed, 18 Mar 2015 10:26:22 +0000 (10:26 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Wed, 18 Mar 2015 10:26:22 +0000 (10:26 +0000)
llvm-svn: 232623

clang/lib/Sema/SemaStmt.cpp

index 3140090..f923f61 100644 (file)
@@ -906,12 +906,12 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
           if (PrevString == CurrString)
             Diag(CaseVals[i].second->getLHS()->getLocStart(),
                  diag::err_duplicate_case) <<
-                 (PrevString.empty() ? CaseValStr : PrevString);
+                 (PrevString.empty() ? StringRef(CaseValStr) : PrevString);
           else
             Diag(CaseVals[i].second->getLHS()->getLocStart(),
                  diag::err_duplicate_case_differing_expr) <<
-                 (PrevString.empty() ? CaseValStr : PrevString) <<
-                 (CurrString.empty() ? CaseValStr : CurrString) <<
+                 (PrevString.empty() ? StringRef(CaseValStr) : PrevString) <<
+                 (CurrString.empty() ? StringRef(CaseValStr) : CurrString) <<
                  CaseValStr;
 
           Diag(CaseVals[i-1].second->getLHS()->getLocStart(),