1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s 2*f4a2713aSLionel Sambuc 3*f4a2713aSLionel Sambuc struct ValueInt 4*f4a2713aSLionel Sambuc { ValueIntValueInt5*f4a2713aSLionel Sambuc ValueInt(int v = 0) : ValueLength(v) {} operator intValueInt6*f4a2713aSLionel Sambuc operator int () const { return ValueLength; } // expected-note 3{{conversion to integral type 'int' declared here}} 7*f4a2713aSLionel Sambuc private: 8*f4a2713aSLionel Sambuc int ValueLength; 9*f4a2713aSLionel Sambuc }; 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc enum E { e }; 12*f4a2713aSLionel Sambuc struct ValueEnum { 13*f4a2713aSLionel Sambuc operator E() const; // expected-note{{conversion to enumeration type 'E' declared here}} 14*f4a2713aSLionel Sambuc }; 15*f4a2713aSLionel Sambuc 16*f4a2713aSLionel Sambuc struct ValueBoth : ValueInt, ValueEnum { }; 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc struct IndirectValueInt : ValueInt { }; 19*f4a2713aSLionel Sambuc struct TwoValueInts : ValueInt, IndirectValueInt { }; 20*f4a2713aSLionel Sambuc test()21*f4a2713aSLionel Sambucvoid test() { 22*f4a2713aSLionel Sambuc (void)new int[ValueInt(10)]; // expected-warning{{implicit conversion from array size expression of type 'ValueInt' to integral type 'int' is a C++11 extension}} 23*f4a2713aSLionel Sambuc (void)new int[ValueEnum()]; // expected-warning{{implicit conversion from array size expression of type 'ValueEnum' to enumeration type 'E' is a C++11 extension}} 24*f4a2713aSLionel Sambuc (void)new int[ValueBoth()]; // expected-error{{ambiguous conversion of array size expression of type 'ValueBoth' to an integral or enumeration type}} 25*f4a2713aSLionel Sambuc 26*f4a2713aSLionel Sambuc (void)new int[TwoValueInts()]; // expected-error{{ambiguous conversion of array size expression of type 'TwoValueInts' to an integral or enumeration type}} 27*f4a2713aSLionel Sambuc } 28