1 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=gnu++98 %s
2 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify -std=c++11 %s
7 ValueInt(int v
= 0) : ValueLength(v
) {}
8 operator int () const { return ValueLength
; } // expected-note 3{{conversion to integral type 'int' declared here}}
15 operator E() const; // expected-note{{conversion to enumeration type 'E' declared here}}
18 struct ValueBoth
: ValueInt
, ValueEnum
{ };
20 struct IndirectValueInt
: ValueInt
{ };
21 struct TwoValueInts
: ValueInt
, IndirectValueInt
{ }; // expected-warning{{direct base 'ValueInt' is inaccessible due to ambiguity:\n struct TwoValueInts -> ValueInt\n struct TwoValueInts -> IndirectValueInt -> ValueInt}}
25 (void)new int[ValueInt(10)];
26 #if __cplusplus <= 199711L // C++03 or earlier modes
27 // expected-warning@-2{{implicit conversion from array size expression of type 'ValueInt' to integral type 'int' is a C++11 extension}}
30 (void)new int[ValueEnum()];
31 #if __cplusplus <= 199711L
32 // expected-warning@-2{{implicit conversion from array size expression of type 'ValueEnum' to enumeration type 'E' is a C++11 extension}}
34 (void)new int[ValueBoth()]; // expected-error{{ambiguous conversion of array size expression of type 'ValueBoth' to an integral or enumeration type}}
36 (void)new int[TwoValueInts()]; // expected-error{{ambiguous conversion of array size expression of type 'TwoValueInts' to an integral or enumeration type}}