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 @@ -267,6 +267,8 @@ Bug Fixes to C++ Support
267
267
was only accepted at namespace scope but not at local function scope.
268
268
- Clang no longer tries to call consteval constructors at runtime when they appear in a member initializer.
269
269
(`#782154 <https://github.com/llvm/llvm-project/issues/82154>`_`)
270
+ - Clang now detects illegal copy constructor with template class as its parameter.
271
+ Fixes (`#80963 https://github.com/llvm/llvm-project/issues/80963 `_)
270
272
271
273
Bug Fixes to AST Handling
272
274
^^^^^^^^^^^^^^^^^^^^^^^^^
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