From 2fbcbb7b38a770366a62dd5dba6c82267087ac65 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Mon, 22 Aug 2016 22:25:03 +0000 Subject: Fix regression introduced by r279164: only pass definitions as the PatternDef to DiagnoseUninstantiableTemplate, teach hasVisibleDefinition to correctly determine whether a function definition is visible, and mark both the function and the template as visible when merging function template definitions to provide hasVisibleDefinition with the relevant information. The change to always pass the right declaration as the PatternDef to DiagnoseUninstantiableTemplate also caused those checks to happen before other diagnostics in InstantiateFunctionDefinition, giving worse diagnostics for the same situations, so I sunk the relevant diagnostics into DiagnoseUninstantiableTemplate. Those parts of this patch are based on changes in reviews.llvm.org/D23492 by Vassil Vassilev. llvm-svn: 279486 --- clang/test/Modules/Inputs/merge-template-pattern-visibility/a.h | 1 + clang/test/Modules/Inputs/merge-template-pattern-visibility/b.h | 2 ++ clang/test/Modules/merge-template-pattern-visibility.cpp | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'clang/test/Modules') diff --git a/clang/test/Modules/Inputs/merge-template-pattern-visibility/a.h b/clang/test/Modules/Inputs/merge-template-pattern-visibility/a.h index 7f9b6497e72..e6592027611 100644 --- a/clang/test/Modules/Inputs/merge-template-pattern-visibility/a.h +++ b/clang/test/Modules/Inputs/merge-template-pattern-visibility/a.h @@ -3,3 +3,4 @@ template struct B; template struct A {}; template struct B : A {}; +template inline auto C(T) {} diff --git a/clang/test/Modules/Inputs/merge-template-pattern-visibility/b.h b/clang/test/Modules/Inputs/merge-template-pattern-visibility/b.h index 5ed18e7e7c5..6db3c2c6c9f 100644 --- a/clang/test/Modules/Inputs/merge-template-pattern-visibility/b.h +++ b/clang/test/Modules/Inputs/merge-template-pattern-visibility/b.h @@ -3,7 +3,9 @@ template struct B; template struct A {}; template struct B : A {}; +template inline auto C(T) {} inline void f() { B bi; + C(0); } diff --git a/clang/test/Modules/merge-template-pattern-visibility.cpp b/clang/test/Modules/merge-template-pattern-visibility.cpp index db759b5a46a..b97f9f113e3 100644 --- a/clang/test/Modules/merge-template-pattern-visibility.cpp +++ b/clang/test/Modules/merge-template-pattern-visibility.cpp @@ -1,4 +1,4 @@ // RUN: rm -rf %t -// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fno-modules-error-recovery \ +// RUN: %clang_cc1 -fmodules -fno-modules-error-recovery -std=c++14 \ // RUN: -fmodule-name=X -emit-module %S/Inputs/merge-template-pattern-visibility/module.modulemap -x c++ \ -// RUN: -fmodules-local-submodule-visibility +// RUN: -fmodules-local-submodule-visibility -o %t/X.pcm -- cgit v1.2.3