brachiosaur |= neck; // OK
}
}
+
+namespace dr2681 { // dr2681: 17
+using size_t = decltype(sizeof(int));
+
+template<class T, size_t N>
+struct H {
+ T array[N];
+};
+template<class T, size_t N>
+struct I {
+ volatile T array[N];
+};
+template<size_t N>
+struct J { // expected-note 3{{candidate}}
+ unsigned char array[N];
+};
+
+H h = { "abc" };
+I i = { "def" };
+static_assert(__is_same(decltype(h), H<char, 4>)); // Not H<const char, 4>
+static_assert(__is_same(decltype(i), I<char, 4>));
+
+J j = { "ghi" }; // expected-error {{no viable constructor or deduction guide}}
+}
// CHECK: FunctionTemplateDecl {{.*}} implicit <deduction guide for A>
// CHECK: |-TemplateTypeParmDecl {{.*}} referenced typename depth 0 index 0 T
// CHECK: |-NonTypeTemplateParmDecl {{.*}} 'size_t':'unsigned {{.*}}' depth 0 index 1 N
- // CHECK: |-CXXDeductionGuideDecl {{.*}} implicit <deduction guide for A> 'auto (T (&)[N]) -> A<T, N>'
- // CHECK: | `-ParmVarDecl {{.*}} 'T (&)[N]'
- // CHECK: `-CXXDeductionGuideDecl {{.*}} implicit used <deduction guide for A> 'auto (const char (&)[5]) -> Array::A<const char, 5>'
- // CHECK: |-TemplateArgument type 'const char'
- // CHECK: | `-QualType {{.*}} 'const char' const
- // CHECK: | `-BuiltinType {{.*}} 'char'
+ // CHECK: |-CXXDeductionGuideDecl {{.*}} implicit <deduction guide for A> 'auto (const T (&)[N]) -> A<T, N>'
+ // CHECK: | `-ParmVarDecl {{.*}} 'const T (&)[N]'
+ // CHECK: `-CXXDeductionGuideDecl {{.*}} implicit used <deduction guide for A> 'auto (const char (&)[5]) -> Array::A<char, 5>'
+ // CHECK: |-TemplateArgument type 'char'
+ // CHECK: | `-BuiltinType {{.*}} 'char'
// CHECK: |-TemplateArgument integral 5
// CHECK: `-ParmVarDecl {{.*}} 'const char (&)[5]'
- // CHECK: FunctionProtoType {{.*}} 'auto (T (&)[N]) -> A<T, N>' dependent trailing_return cdecl
+ // CHECK: FunctionProtoType {{.*}} 'auto (const T (&)[N]) -> A<T, N>' dependent trailing_return cdecl
// CHECK: |-InjectedClassNameType {{.*}} 'A<T, N>' dependent
// CHECK: | `-CXXRecord {{.*}} 'A'
- // CHECK: `-LValueReferenceType {{.*}} 'T (&)[N]' dependent
- // CHECK: `-DependentSizedArrayType {{.*}} 'T[N]' dependent
- // CHECK: |-TemplateTypeParmType {{.*}} 'T' dependent depth 0 index 0
- // CHECK: | `-TemplateTypeParm {{.*}} 'T'
- // CHECK: `-DeclRefExpr {{.*}} 'size_t':'unsigned {{.*}}' NonTypeTemplateParm {{.*}} 'N' 'size_t':'unsigned {{.*}}'
+ // CHECK: `-LValueReferenceType {{.*}} 'const T (&)[N]' dependent
+ // CHECK: `-QualType {{.*}} 'const T[N]' const
+ // CHECK: `-DependentSizedArrayType {{.*}} 'T[N]' dependent
+ // CHECK: |-TemplateTypeParmType {{.*}} 'T' dependent depth 0 index 0
+ // CHECK: | `-TemplateTypeParm {{.*}} 'T'
+ // CHECK: `-DeclRefExpr {{.*}} 'size_t':'unsigned{{.*}}' NonTypeTemplateParm {{.*}} 'N' 'size_t':'unsigned{{.*}}'
}
namespace BraceElision {