File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -281,6 +281,8 @@ Bug Fixes to C++ Support
281
281
a requires-clause lie at the same depth as those of the surrounding lambda. This,
282
282
in turn, results in the wrong template argument substitution during constraint checking.
283
283
(`#78524 <https://github.com/llvm/llvm-project/issues/78524 >`_)
284
+ - Clang now detects illegal copy constructor with template class as its parameter.
285
+ Fixes (`#80963 https://github.com/llvm/llvm-project/issues/80963> `_)
284
286
285
287
Bug Fixes to AST Handling
286
288
^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -10921,9 +10921,7 @@ void Sema::CheckConstructor(CXXConstructorDecl *Constructor) {
10921
10921
// either there are no other parameters or else all other
10922
10922
// parameters have default arguments.
10923
10923
if (!Constructor->isInvalidDecl() &&
10924
- Constructor->hasOneParamOrDefaultArgs() &&
10925
- Constructor->getTemplateSpecializationKind() !=
10926
- TSK_ImplicitInstantiation) {
10924
+ Constructor->hasOneParamOrDefaultArgs()) {
10927
10925
QualType ParamType = Constructor->getParamDecl(0)->getType();
10928
10926
QualType ClassTy = Context.getTagDeclType(ClassDecl);
10929
10927
if (Context.getCanonicalType(ParamType).getUnqualifiedType() == ClassTy) {
Original file line number Diff line number Diff line change
1
+ // RUN: %clang_cc1 -fsyntax-only -verify %s
2
+
3
+ template < class T , class V > struct A
4
+ {
5
+ A ();
6
+ A (A &);
7
+ A (A < V,T >);
8
+ // expected-error@-1 {{copy constructor must pass its first argument by reference}}
9
+ };
10
+
11
+ void f ()
12
+ {
13
+ A <int , int > (A < int , int >());
14
+ // expected-note@-1 {{in instantiation of template class 'A<int, int>' requested here}}
15
+
16
+ A <int , double > (A < int , double >());
17
+ }
You can’t perform that action at this time.
0 commit comments