r272425 - [-fms-extensions] Don't crash on explicit class-scope specializations & default arguments
David Majnemer via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 10 13:21:15 PDT 2016
Author: majnemer
Date: Fri Jun 10 15:21:15 2016
New Revision: 272425
URL: http://llvm.org/viewvc/llvm-project?rev=272425&view=rev
Log:
[-fms-extensions] Don't crash on explicit class-scope specializations & default arguments
The code had a typo it was doing:
Param->setUninstantiatedDefaultArg(Param->getUninstantiatedDefaultArg());
This is a no-op but may assert, we wanted to do:
Param->setUninstantiatedDefaultArg(OldParam->getUninstantiatedDefaultArg());
This fixes PR28082.
Modified:
cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp
Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=272425&r1=272424&r2=272425&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Fri Jun 10 15:21:15 2016
@@ -381,7 +381,7 @@ void Parser::ParseLexedMethodDeclaration
assert (!OldParam->hasUnparsedDefaultArg());
if (OldParam->hasUninstantiatedDefaultArg())
Param->setUninstantiatedDefaultArg(
- Param->getUninstantiatedDefaultArg());
+ OldParam->getUninstantiatedDefaultArg());
else
Param->setDefaultArg(OldParam->getInit());
}
Modified: cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp?rev=272425&r1=272424&r2=272425&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp (original)
+++ cfe/trunk/test/SemaTemplate/ms-function-specialization-class-scope.cpp Fri Jun 10 15:21:15 2016
@@ -75,3 +75,12 @@ namespace Duplicates {
// here.
template struct A<int>;
}
+
+namespace PR28082 {
+struct S {
+ template <int>
+ int f(int = 0);
+ template <>
+ int f<0>(int); // expected-warning {{Microsoft extension}}
+};
+}
More information about the cfe-commits
mailing list