[clang] 3978333 - Add test for PR50039.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue May 11 17:35:46 PDT 2021


Author: Richard Smith
Date: 2021-05-11T17:35:34-07:00
New Revision: 3978333b71bff3516ad69aac484b808617976c7a

URL: https://github.com/llvm/llvm-project/commit/3978333b71bff3516ad69aac484b808617976c7a
DIFF: https://github.com/llvm/llvm-project/commit/3978333b71bff3516ad69aac484b808617976c7a.diff

LOG: Add test for PR50039.

I believe Clang's behavior is correct according to the standard here,
but this is an unusual situation for which we had no test coverage, so
I'm adding some.

Added: 
    

Modified: 
    clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp b/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
index c42fda780430..ad9cfc7cdd9d 100644
--- a/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
+++ b/clang/test/SemaTemplate/temp_arg_nontype_cxx20.cpp
@@ -292,3 +292,16 @@ namespace Predefined {
     Y<B{__func__[0]}>(); // expected-error {{reference to subobject of predefined '__func__' variable}}
   }
 }
+
+namespace DependentCTAD {
+  template<auto> struct A {};
+  template<template<typename> typename T, T V> void f(A<V>); // expected-note {{couldn't infer template argument 'T'}}
+  template<typename T> struct B { constexpr B(T) {} };
+
+  void g() {
+    // PR50039: Note that we could in principle deduce T here, but the language
+    // deduction rules don't support that.
+    f(A<B(0)>()); // expected-error {{no matching function}}
+    f<B>(A<B(0)>()); // OK
+  }
+}


        


More information about the cfe-commits mailing list