diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -14493,7 +14493,7 @@ FunctionScopeInfo *FSI = getCurFunction(); FunctionDecl *FD = dcl ? dcl->getAsFunction() : nullptr; - if (FSI->UsesFPIntrin && !FD->hasAttr()) + if (FSI->UsesFPIntrin && FD && !FD->hasAttr()) FD->addAttr(StrictFPAttr::CreateImplicit(Context)); sema::AnalysisBasedWarnings::Policy WP = AnalysisWarnings.getDefaultPolicy(); diff --git a/clang/test/SemaCXX/rounding-math-crash.cpp b/clang/test/SemaCXX/rounding-math-crash.cpp new file mode 100644 --- /dev/null +++ b/clang/test/SemaCXX/rounding-math-crash.cpp @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -fsyntax-only -frounding-math -verify %s + +template b::a() {} // expected-error {{nested name specifier}}