forked from OSchip/llvm-project
Don't diagnose a redeclaration of a deduction guide if the prior
declaration is not visible. In passing, add a test for a similar case of conflicting redeclarations of internal-linkage structured bindings. (This case already works).
This commit is contained in:
parent
a0226f9bff
commit
c32d261e27
|
@ -678,7 +678,7 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old,
|
|||
// for the same class template shall not have equivalent
|
||||
// parameter-declaration-clauses.
|
||||
if (isa<CXXDeductionGuideDecl>(New) &&
|
||||
!New->isFunctionTemplateSpecialization()) {
|
||||
!New->isFunctionTemplateSpecialization() && isVisible(Old)) {
|
||||
Diag(New->getLocation(), diag::err_deduction_guide_redeclared);
|
||||
Diag(Old->getLocation(), diag::note_previous_declaration);
|
||||
}
|
||||
|
|
|
@ -1 +1,4 @@
|
|||
module Decls { header "decls.h" }
|
||||
module Decls {
|
||||
header "decls.h"
|
||||
explicit module Unimported { header "unimported.h" }
|
||||
}
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
template<typename T> struct DeductionGuide {};
|
||||
DeductionGuide() -> DeductionGuide<int>;
|
|
@ -0,0 +1,4 @@
|
|||
module Decls {
|
||||
header "decls.h"
|
||||
explicit module Unimported { header "unimported.h" }
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
namespace StructuredBinding {
|
||||
struct Q { int p, q; };
|
||||
static auto [a, b] = Q();
|
||||
}
|
|
@ -9,3 +9,7 @@ struct MergeExceptionSpec {
|
|||
#include "decls.h"
|
||||
|
||||
MergeExceptionSpec mergeExceptionSpec2;
|
||||
|
||||
template<typename T> struct DeductionGuide {};
|
||||
DeductionGuide() -> DeductionGuide<int>;
|
||||
DeductionGuide a;
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// RUN: rm -rf %t
|
||||
// RUN: %clang_cc1 -x c++ -std=c++20 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/cxx20 %s -verify -fno-modules-error-recovery
|
||||
|
||||
// expected-no-diagnostics
|
||||
|
||||
#include "decls.h"
|
||||
|
||||
namespace StructuredBinding {
|
||||
struct R { int x, y; };
|
||||
static auto [a, b] = R();
|
||||
}
|
Loading…
Reference in New Issue