1 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
2 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
3 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
4 // RUN: %clang_cc1 -std=c++17 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
5 // RUN: %clang_cc1 -std=c++20 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
6 // RUN: %clang_cc1 -std=c++23 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
9 __extension__
typedef __SIZE_TYPE__
size_t;
11 template<typename T
> struct initializer_list
{
13 initializer_list(const T
*p
, size_t n
);
17 namespace dr1004
{ // dr1004: 5
18 template<typename
> struct A
{};
19 template<typename
> struct B1
{};
20 template<template<typename
> class> struct B2
{};
21 template<typename X
> void f(); // expected-note {{[with X = dr1004::A<int>]}}
22 template<template<typename
> class X
> void f(); // expected-note {{[with X = dr1004::A]}}
23 template<template<typename
> class X
> void g(); // expected-note {{[with X = dr1004::A]}}
24 template<typename X
> void g(); // expected-note {{[with X = dr1004::A<int>]}}
29 f
<A
>(); // expected-error {{ambiguous}}
30 g
<A
>(); // expected-error {{ambiguous}}
34 // This example (from the standard) is actually ill-formed, because
35 // name lookup of "T::template A" names the constructor.
36 template<class T
, template<class> class U
= T::template A
> struct Third
{ }; // expected-error {{is a constructor name}}
37 Third
<A
<int> > t
; // expected-note {{in instantiation of default argument}}
40 namespace dr1042
{ // dr1042: 3.5
41 #if __cplusplus >= 201402L
42 // C++14 added an attribute that we can test the semantics of.
43 using foo
[[deprecated
]] = int; // expected-note {{'foo' has been explicitly marked deprecated here}}
44 foo f
= 12; // expected-warning {{'foo' is deprecated}}
45 #elif __cplusplus >= 201103L
46 // C++11 did not have any attributes that could be applied to an alias
47 // declaration, so the best we can test is that we accept an empty attribute
53 namespace dr1048
{ // dr1048: 3.6
58 #if __cplusplus >= 201103L
59 // ok: we deduce non-const A in each case.
61 while (1) switch (n
) {
71 namespace dr1054
{ // dr1054: no
72 // FIXME: Test is incomplete.
73 struct A
{} volatile a
;
75 // FIXME: This is wrong: an lvalue-to-rvalue conversion is applied here,
76 // which copy-initializes a temporary from 'a'. Therefore this is
77 // ill-formed because A does not have a volatile copy constructor.
78 // (We might want to track this aspect under dr1383 instead?)
79 a
; // expected-warning {{assign into a variable to force a volatile load}}
83 namespace dr1070
{ // dr1070: 3.5
84 #if __cplusplus >= 201103L
86 A(std::initializer_list
<int>);
94 std::initializer_list
<int> a
;
96 std::initializer_list
<double> c
;