FUSE ESB - CXF Webservice Fault - web-services

I have a CXF webservice exposed in FUSE ESB. In case of an exception a SOAP Fault is thrown from the application and the response is coming as below in SOAP UI. What should I do to avoid/remove the classContext tags in the response.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>8001 - The request context failed authentication policy!</faultstring>
<detail>
<PolicyException xmlns="http://www.example.com/com/xyz/sdp/api/ws"/>
<ns1:PolicyException xmlns:ns1="http://www.example.com/com/xyz/sdp/api/ws">
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">com.xyz.sdp.api.processors.request.AuthenticationProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.component.bean.BeanProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.util.AsyncProcessorHelper</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.component.bean.BeanProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.impl.ProcessorEndpoint</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.impl.ProcessorEndpoint$1</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.SendProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.management.InstrumentationProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.CamelInternalProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.Pipeline</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.Pipeline</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.management.InstrumentationProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.CamelInternalProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.TryProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.TryProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.management.InstrumentationProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.CamelInternalProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.CamelInternalProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.util.AsyncProcessorHelper</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.processor.DelegateAsyncProcessor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.component.cxf.CxfConsumer$1</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.camel.component.cxf.CxfConsumer$1</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.interceptor.ServiceInvokerInterceptor$1</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">java.util.concurrent.Executors$RunnableAdapter</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">java.util.concurrent.FutureTask$Sync</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">java.util.concurrent.FutureTask</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.workqueue.SynchronousExecutor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.interceptor.ServiceInvokerInterceptor</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.phase.PhaseInterceptorChain</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.ChainInitiationObserver</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.http.AbstractHTTPDestination</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.servlet.ServletController</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.servlet.ServletController</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.servlet.ServletController</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.servlet.CXFNonSpringServlet</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.servlet.AbstractHTTPServlet</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.servlet.AbstractHTTPServlet</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">javax.servlet.http.HttpServlet</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.apache.cxf.transport.servlet.AbstractHTTPServlet</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.servlet.ServletHolder</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.servlet.ServletHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.handler.ScopedHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.security.SecurityHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.session.SessionHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.handler.ContextHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.ops4j.pax.web.service.jetty.internal.HttpServiceContext</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.servlet.ServletHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.session.SessionHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.handler.ContextHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.handler.ScopedHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.handler.HandlerWrapper</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.Server</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.AbstractHttpConnection</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.AbstractHttpConnection</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.http.HttpParser</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.http.HttpParser</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.server.AsyncHttpConnection</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.io.nio.SelectChannelEndPoint</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.io.nio.SelectChannelEndPoint$1</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.util.thread.QueuedThreadPool</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">org.eclipse.jetty.util.thread.QueuedThreadPool$3</classContext>
<classContext xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">java.lang.Thread</classContext>
<faultInfo xsi:type="ns2:PFaultInfo" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns6="http://ws.hij.com/mno/mci" xmlns:ns5="http://www.hij.com/mno/service/management-v8" xmlns:ns4="http://ws.hij.com/mno/userprofile-v2" xmlns:ns3="http://ws.hij.com/mno/commerce/v6" xmlns:ns2="http://ca.abc.sdp.xyz.com/">
<code>8001</code>
<message>The request context failed authentication policy!</message>
</faultInfo>
</ns1:PolicyException>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>

It is a bug due to Karaf, see https://issues.apache.org/jira/browse/KARAF-4429,
which uses an endorsed java.lang.Exception that is replacing the JDK one to provide enhanced logging capability.
Thanks to this feature, you are able to get full OSGi info on the StackTrace entry in the logs (have you seen the square brackets with the [bundleId:bundleSymbolicName:bundleVersion] when you send the log:display command?) but it introduces a bug that prevents SOAP Fault to be marshalled properly by JaxB.
Until the Karaf Issue is solved, you could workaround the problem in your Fuse ESB instance by deleting the the file:
{FUSE_ESB_HOME}/lib/endorsed/org.apache.karaf.exception-x.x.x.jar
you'll loose OSGi info on some elements of the StackTrace in the logs but everything else should work right.

See this page, at the section SOAP Fault for debugging
http://cxf.apache.org/docs/debugging-and-logging.html
About the options to turn on|off stacktraces and whatnot.

Related

c++ Boost : gregorian_calendar.ipp(77,1): error C2666: '-': 17 overloads have similar conversions in Visual Studio 2019 x64

i have a strange compilation error when trying to link a simple app with boost and libunistd.
Now both are complied with x64
my linking librarys are :
libboost_filesystem-vc142-mt-sgd-x64-1_75.lib
libboost_system-vc142-mt-sgd-x64-1_75.lib
libboost_thread-vc142-mt-sgd-x64-1_75.lib
libunistd.lib
libportable.lib
using flags :
BOOST_ASIO_ENABLE_BUFFER_DEBUGGING
BOOST_ASIO_ENABLE_HANDLER_TRACKING
But i keep getting :
C:\Dev\my\cpp\libs\boost_1_75_0\boost\date_time\gregorian_calendar.ipp(77,1): error C2666: '-': 17 overloads have similar conversions
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(855,17): message : could be '_uint128 operator -(const _uint128 &,unsigned short)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(852,17): message : or '_uint128 operator -(const _uint128 &,short)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(849,17): message : or '_uint128 operator -(const _uint128 &,unsigned int)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(846,17): message : or '_uint128 operator -(const _uint128 &,int)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(843,17): message : or '_uint128 operator -(const _uint128 &,unsigned long)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(840,17): message : or '_uint128 operator -(const _uint128 &,long)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(837,17): message : or '_uint128 operator -(const _uint128 &,unsigned __int64)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(834,17): message : or '_uint128 operator -(const _uint128 &,__int64)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(830,17): message : or '_int128 operator -(const _int128 &,unsigned short)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(827,17): message : or '_int128 operator -(const _int128 &,short)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(824,17): message : or '_int128 operator -(const _int128 &,unsigned int)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(821,17): message : or '_int128 operator -(const _int128 &,int)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(818,17): message : or '_int128 operator -(const _int128 &,unsigned long)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(815,17): message : or '_int128 operator -(const _int128 &,long)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(812,17): message : or '_int128 operator -(const _int128 &,unsigned __int64)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(809,17): message : or '_int128 operator -(const _int128 &,__int64)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(347,17): message : or '_uint128 operator -(const _uint128 &,const _uint128 &)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(342,17): message : or '_uint128 operator -(const _uint128 &,const _int128 &)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(337,16): message : or '_int128 operator -(const _int128 &,const _uint128 &)'
1>C:\Dev\my\cpp\libs\libunistd-master\unistd\int128\Int128.h(332,16): message : or '_int128 operator -(const _int128 &,const _int128 &)'
1>C:\Dev\my\cpp\libs\boost_1_75_0\boost\date_time\gregorian\greg_duration.hpp(119,17): message : or 'boost::gregorian::date_duration boost::gregorian::operator -(boost::gregorian::date_duration,const boost::gregorian::date_duration &)' [found using argument-dependent lookup]
1>C:\Dev\my\cpp\libs\boost_1_75_0\boost\date_time\gregorian_calendar.ipp(77,1): message : or 'built-in C++ operator-(int, int)'
1>C:\Dev\my\cpp\libs\boost_1_75_0\boost\date_time\gregorian_calendar.ipp(77,1): message : while trying to match the argument list '(int, const MonthType)'
1> with
1> [
1> MonthType=boost::gregorian::greg_month
1> ]
1>C:\Dev\my\cpp\libs\boost_1_75_0\boost\date_time\gregorian_calendar.ipp(76): message : while compiling class template member function 'unsigned int boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>::day_number(const boost::date_time::year_month_day_base<boost::gregorian::greg_year,boost::gregorian::greg_month,boost::gregorian::greg_day> &)'
1>C:\Dev\my\cpp\libs\boost_1_75_0\boost\date_time\date.hpp(75): message : see reference to function template instantiation 'unsigned int boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>::day_number(const boost::date_time::year_month_day_base<boost::gregorian::greg_year,boost::gregorian::greg_month,boost::gregorian::greg_day> &)' being compiled
1>C:\Dev\my\cpp\libs\boost_1_75_0\boost\date_time\gregorian\greg_calendar.hpp(28): message : see reference to class template instantiation 'boost::date_time::gregorian_calendar_base<boost::gregorian::greg_year_month_day,unsigned int>' being compiled
this is the boost part which it keep fail:
template<typename ymd_type_, typename date_int_type_>
BOOST_CXX14_CONSTEXPR
inline
date_int_type_
gregorian_calendar_base<ymd_type_,date_int_type_>::day_number(const ymd_type& ymd)
{
unsigned short a = static_cast<unsigned short>((14-ymd.month)/12);
unsigned short y = static_cast<unsigned short>(ymd.year + 4800 - a);
unsigned short m = static_cast<unsigned short>(ymd.month + 12*a - 3);
unsigned long d = ymd.day + ((153*m + 2)/5) + 365*y + (y/4) - (y/100) + (y/400) - 32045;
return static_cast<date_int_type>(d);
}
and this is the int128 that keep failing
Those operators designed with uniformly typed arguments in mind:
inline _uint128 operator-(const _uint128 &lft, const _int128 &rhs)
There is also default C++ operator that takes two ints. If ymd.month is of type _int128 or is convertible to it, the expression (14-ymd.month) is ambiguous because any substitution would require equal number of type conversions.
You have to convert an int operand explicitly.

How do you match a C++ template function call using Clang AST matchers?

I am working on a small project where I am trying to implement a refactoring tool using Clang's LibTooling. As part of this project, I need to find calls to a specific function from a specific library.
My attempts at using clang-query to come up with the AST matchers have failed.
However, I have discovered the following:
I can successfully find calls to non-template functions using my AST matchers.
A similar AST matcher query fails to find calls to a template function.
I have written the following test program to be able to post it here as a self-sufficient example, without depending on the library that I am working with:
template <typename T>
int func1(T param) {
return 4;
}
int main() {
int value = 4;
int result = func1(value);
return 0;
}
In order to observe the generated AST by Clang, I compiled the above program by using:
clang -Xclang -ast-dump -fsyntax-only test.cpp
The following is the generated AST:
TranslationUnitDecl 0xad9088 <<invalid sloc>> <invalid sloc>
|-TypedefDecl 0xad9960 <<invalid sloc>> <invalid sloc> implicit __int128_t '__int128'
| `-BuiltinType 0xad9620 '__int128'
|-TypedefDecl 0xad99d0 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128'
| `-BuiltinType 0xad9640 'unsigned __int128'
|-TypedefDecl 0xad9d48 <<invalid sloc>> <invalid sloc> implicit __NSConstantString '__NSConstantString_tag'
| `-RecordType 0xad9ac0 '__NSConstantString_tag'
| `-CXXRecord 0xad9a28 '__NSConstantString_tag'
|-TypedefDecl 0xad9de0 <<invalid sloc>> <invalid sloc> implicit __builtin_ms_va_list 'char *'
| `-PointerType 0xad9da0 'char *'
| `-BuiltinType 0xad9120 'char'
|-TypedefDecl 0xb16e98 <<invalid sloc>> <invalid sloc> implicit __builtin_va_list '__va_list_tag [1]'
| `-ConstantArrayType 0xb16e40 '__va_list_tag [1]' 1
| `-RecordType 0xad9ed0 '__va_list_tag'
| `-CXXRecord 0xad9e38 '__va_list_tag'
|-FunctionTemplateDecl 0xb17160 <test.cpp:1:1, line:4:1> line:2:5 func1
| |-TemplateTypeParmDecl 0xb16ef0 <line:1:11, col:20> col:20 referenced typename depth 0 index 0 T
| |-FunctionDecl 0xb170c0 <line:2:1, line:4:1> line:2:5 func1 'int (T)'
| | |-ParmVarDecl 0xb16fc8 <col:11, col:13> col:13 param 'T'
| | `-CompoundStmt 0xb17238 <col:20, line:4:1>
| | `-ReturnStmt 0xb17228 <line:3:5, col:12>
| | `-IntegerLiteral 0xb17208 <col:12> 'int' 4
| `-FunctionDecl 0xb17700 <line:2:1, line:4:1> line:2:5 used func1 'int (int)'
| |-TemplateArgument type 'int'
| |-ParmVarDecl 0xb17608 <col:11, col:13> col:13 param 'int':'int'
| `-CompoundStmt 0xb17960 <col:20, line:4:1>
| `-ReturnStmt 0xb17950 <line:3:5, col:12>
| `-IntegerLiteral 0xb17208 <col:12> 'int' 4
`-FunctionDecl 0xb172a0 <line:6:1, line:10:1> line:6:5 main 'int ()'
`-CompoundStmt 0xb17928 <col:12, line:10:1>
|-DeclStmt 0xb17408 <line:7:5, col:18>
| `-VarDecl 0xb17380 <col:5, col:17> col:9 used value 'int' cinit
| `-IntegerLiteral 0xb173e8 <col:17> 'int' 4
|-DeclStmt 0xb178e0 <line:8:5, col:30>
| `-VarDecl 0xb17438 <col:5, col:29> col:9 result 'int' cinit
| `-CallExpr 0xb178a0 <col:18, col:29> 'int'
| |-ImplicitCastExpr 0xb17888 <col:18> 'int (*)(int)' <FunctionToPointerDecay>
| | `-DeclRefExpr 0xb17800 <col:18> 'int (int)' lvalue Function 0xb17700 'func1' 'int (int)' (FunctionTemplate 0xb17160 'func1')
| `-ImplicitCastExpr 0xb178c8 <col:24> 'int' <LValueToRValue>
| `-DeclRefExpr 0xb174e8 <col:24> 'int' lvalue Var 0xb17380 'value' 'int'
`-ReturnStmt 0xb17918 <line:9:5, col:12>
`-IntegerLiteral 0xb178f8 <col:12> 'int' 0
Now, based on what I could find from Introduction to the Clang AST and AST Matcher Reference, I came up with the following two AST matchers and tested in clang-query:
clang-query> match callExpr(callee(functionTemplateDecl(hasName("func1"))))
0 matches.
clang-query> match callExpr(hasDeclaration(functionTemplateDecl(hasName("func1"))))
0 matches.
They both return 0 matches. The same queries work if I change func1 so that it is not a template function, and if I change functionTemplateDecl to functionDecl.
Any ideas what's going on?
if you use functionDecl in your matcher, it should work on your template code as well.
1 template <typename T>
2 int func1(T param) {
3 return 4;
4 }
5
6 int func1(int param1, int param2) {
7 return 5;
8 }
9
10 int main() {
11 int value = 4;
12 int result = func1(value);
13 int result2 = func1(value, value);
14 return 0;
15 }
clang-query> match callExpr(callee(functionDecl(hasName("func1"))))
Match #1:
/.../test.cpp:12:18: note: "root" binds here
int result = func1(value);
^~~~~~~~~~~~
Match #2:
/.../test.cpp:13:19: note: "root" binds here
int result2 = func1(value, value);
^~~~~~~~~~~~~~~~~~~
2 matches.
if you want to go for the template instantiations, add a Narrowing matcher:
clang-query> match callExpr(callee(functionDecl(hasName("func1"), isTemplateInstantiation())))
Match #1:
/.../test.cpp:12:18: note: "root" binds here
int result = func1(value);
^~~~~~~~~~~~
1 match.

C++ “no match for operator=“ error in lambda function

I have a lambda function in a non-static class member function, used in std::find.
//Somewhere in the header...
Gtk::ComboBoxText *optionChoiceComboBoxText = nullptr; // Initialized later in code
std::vector<OptionData> optionList;
int currentOptionPositionInList = -1;
// In Interface.cpp
Interface::optionChangedHandler() {
currentOptionPositionInList = std::distance(optionList.begin(),
find(optionList.begin(), optionList.end(), [&](OptionData const& o) {
std::string s = optionChoiceComboBoxText->get_active_text();
return s == o.name;
})); //Error is here
}
Here is the error with notes:
[ 66%] Building CXX object CMakeFiles/RNS.dir/src/GUI/Interface.cpp.o
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
from /usr/include/c++/5/bits/char_traits.h:39,
from /usr/include/c++/5/ios:40,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iterator:64,
from /usr/include/glibmm-2.4/glibmm/ustring.h:29,
from /usr/include/glibmm-2.4/glibmm/exception.h:25,
from /usr/include/glibmm-2.4/glibmm/error.h:23,
from /usr/include/glibmm-2.4/glibmm/thread.h:49,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/giomm-2.4/giomm.h:23,
from /home/crefrod/RNS/src/GUI/Interface.cpp:5:
/usr/include/c++/5/bits/predefined_ops.h: In instantiation of ‘bool __gnu_cxx::__ops::_Iter_equals_val<_Value>::operator()(_Iterator) [with _Iterator = __gnu_cxx::__normal_iterator<OptionData*, std::vector<OptionData> >; _Value = const Interface::optionChangedHandler()::<lambda(const OptionData&)>]’:
/usr/include/c++/5/bits/stl_algo.h:120:14: required from ‘_RandomAccessIterator std::__find_if(_RandomAccessIterator, _RandomAccessIterator, _Predicate, std::random_access_iterator_tag) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<OptionData*, std::vector<OptionData> >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const Interface::optionChangedHandler()::<lambda(const OptionData&)> >]’
/usr/include/c++/5/bits/stl_algo.h:161:23: required from ‘_Iterator std::__find_if(_Iterator, _Iterator, _Predicate) [with _Iterator = __gnu_cxx::__normal_iterator<OptionData*, std::vector<OptionData> >; _Predicate = __gnu_cxx::__ops::_Iter_equals_val<const Interface::optionChangedHandler()::<lambda(const OptionData&)> >]’
/usr/include/c++/5/bits/stl_algo.h:3790:28: required from ‘_IIter std::find(_IIter, _IIter, const _Tp&) [with _IIter = __gnu_cxx::__normal_iterator<OptionData*, std::vector<OptionData> >; _Tp = Interface::optionChangedHandler()::<lambda(const OptionData&)>]’
/home/crefrod/RNS/src/GUI/Interface.cpp:70:50: required from here
/usr/include/c++/5/bits/predefined_ops.h:194:17: error: no match for ‘operator==’ (operand types are ‘OptionData’ and ‘const Interface::optionChangedHandler()::<lambda(const OptionData&)>’)
{ return *__it == _M_value; }
^
In file included from /usr/include/c++/5/iterator:63:0,
from /usr/include/glibmm-2.4/glibmm/ustring.h:29,
from /usr/include/glibmm-2.4/glibmm/exception.h:25,
from /usr/include/glibmm-2.4/glibmm/error.h:23,
from /usr/include/glibmm-2.4/glibmm/thread.h:49,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/giomm-2.4/giomm.h:23,
from /home/crefrod/RNS/src/GUI/Interface.cpp:5:
/usr/include/c++/5/bits/stl_iterator.h:820:5: note: candidate: template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_IteratorL, _Container>&, const __gnu_cxx::__normal_iterator<_IteratorR, _Container>&)
operator==(const __normal_iterator<_IteratorL, _Container>& __lhs,
^
/usr/include/c++/5/bits/stl_iterator.h:820:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
from /usr/include/c++/5/bits/char_traits.h:39,
from /usr/include/c++/5/ios:40,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iterator:64,
from /usr/include/glibmm-2.4/glibmm/ustring.h:29,
from /usr/include/glibmm-2.4/glibmm/exception.h:25,
from /usr/include/glibmm-2.4/glibmm/error.h:23,
from /usr/include/glibmm-2.4/glibmm/thread.h:49,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/giomm-2.4/giomm.h:23,
from /home/crefrod/RNS/src/GUI/Interface.cpp:5:
/usr/include/c++/5/bits/predefined_ops.h:194:17: note: ‘OptionData’ is not derived from ‘const __gnu_cxx::__normal_iterator<_IteratorL, _Container>’
{ return *__it == _M_value; }
^
In file included from /usr/include/c++/5/iterator:63:0,
from /usr/include/glibmm-2.4/glibmm/ustring.h:29,
from /usr/include/glibmm-2.4/glibmm/exception.h:25,
from /usr/include/glibmm-2.4/glibmm/error.h:23,
from /usr/include/glibmm-2.4/glibmm/thread.h:49,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/giomm-2.4/giomm.h:23,
from /home/crefrod/RNS/src/GUI/Interface.cpp:5:
/usr/include/c++/5/bits/stl_iterator.h:827:5: note: candidate: template<class _Iterator, class _Container> bool __gnu_cxx::operator==(const __gnu_cxx::__normal_iterator<_Iterator, _Container>&, const __gnu_cxx::__normal_iterator<_Iterator, _Container>&)
operator==(const __normal_iterator<_Iterator, _Container>& __lhs,
^
/usr/include/c++/5/bits/stl_iterator.h:827:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
from /usr/include/c++/5/bits/char_traits.h:39,
from /usr/include/c++/5/ios:40,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iterator:64,
from /usr/include/glibmm-2.4/glibmm/ustring.h:29,
from /usr/include/glibmm-2.4/glibmm/exception.h:25,
from /usr/include/glibmm-2.4/glibmm/error.h:23,
from /usr/include/glibmm-2.4/glibmm/thread.h:49,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/giomm-2.4/giomm.h:23,
from /home/crefrod/RNS/src/GUI/Interface.cpp:5:
/usr/include/c++/5/bits/predefined_ops.h:194:17: note: ‘OptionData’ is not derived from ‘const __gnu_cxx::__normal_iterator<_Iterator, _Container>’
{ return *__it == _M_value; }
^
In file included from /usr/include/x86_64-linux-gnu/c++/5/bits/c++allocator.h:33:0,
from /usr/include/c++/5/bits/allocator.h:46,
from /usr/include/c++/5/string:41,
from /usr/include/c++/5/bits/locale_classes.h:40,
from /usr/include/c++/5/bits/ios_base.h:41,
from /usr/include/c++/5/ios:42,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iterator:64,
from /usr/include/glibmm-2.4/glibmm/ustring.h:29,
from /usr/include/glibmm-2.4/glibmm/exception.h:25,
from /usr/include/glibmm-2.4/glibmm/error.h:23,
from /usr/include/glibmm-2.4/glibmm/thread.h:49,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/giomm-2.4/giomm.h:23,
from /home/crefrod/RNS/src/GUI/Interface.cpp:5:
/usr/include/c++/5/ext/new_allocator.h:139:5: note: candidate: template<class _Tp> bool __gnu_cxx::operator==(const __gnu_cxx::new_allocator<_Tp>&, const __gnu_cxx::new_allocator<_Tp>&)
operator==(const new_allocator<_Tp>&, const new_allocator<_Tp>&)
^
/usr/include/c++/5/ext/new_allocator.h:139:5: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/5/bits/stl_algobase.h:71:0,
from /usr/include/c++/5/bits/char_traits.h:39,
from /usr/include/c++/5/ios:40,
from /usr/include/c++/5/ostream:38,
from /usr/include/c++/5/iterator:64,
from /usr/include/glibmm-2.4/glibmm/ustring.h:29,
from /usr/include/glibmm-2.4/glibmm/exception.h:25,
from /usr/include/glibmm-2.4/glibmm/error.h:23,
from /usr/include/glibmm-2.4/glibmm/thread.h:49,
from /usr/include/glibmm-2.4/glibmm.h:87,
from /usr/include/giomm-2.4/giomm.h:23,
from /home/crefrod/RNS/src/GUI/Interface.cpp:5:
/usr/include/c++/5/bits/predefined_ops.h:194:17: note: ‘OptionData’ is not derived from ‘const __gnu_cxx::new_allocator<_Tp>’
{ return *__it == _M_value; }
So it looks like the compiler tries to assign OptionData to the lambda itself (or what is ‘const Interface::optionChangedHandler()::<lambda(const OptionData&)>’). But I do not understand where does OptionData come from, because both OptionData.name and s are std::string's.
You need to replace std::find with std::find_if.
std::find has the signature find( InputIt first, InputIt last, const T& value ), it thinks you are passing your lambda as a type T, which is why it is trying to convert your lambda to a OptionData and getting upset

How to get the AST of a single cpp file with clang?

I know that it will never be fully accurate without the headers because C++ isn't context free.
Using the classic example of 'A B(C);', it means that it can be recognized as a function declaration or an object definition. Either is fine for me. I just need the file totally parsed.
I am not interested in the semantic analysis of the code, just in the syntactic one and AFAIK the grammar of clang is one of the best.
The problem is that in some scenarios clang is avoiding some declarations when it doesn't know the types although I guess it can correctly parse it.
See the following case. Content of class.cpp:
A::A() { }
A::~A() { }
void A::B() { }
A::C() { }
Executing the clang command line application:
$ clang -Xclang -ast-dump -fsyntax-only class.cpp
it's just recognizing as AST nodes the constructor and the last method.
typedef char *__builtin_va_list;
int A() (CompoundStmt 0x9a6a570 <class.cpp:3:8, col:10>)
int C() (CompoundStmt 0x9a6a600 <class.cpp:9:8, col:10>)
Is there any way to get the complete AST tree?
Thanks!
I'm not sure if this is what you need:
test.cpp:
class A {
A();
~A();
void B();
void C();
};
A::A() {}
A::~A() {}
void A::B() {}
void A::C() {}
To dump the AST use: clang -Xclang -ast-dump -fsyntax-only test.cpp
TranslationUnitDecl 0x204f150 <<invalid sloc>> <invalid sloc>
|-TypedefDecl 0x204f690 <<invalid sloc>> <invalid sloc> implicit __int128_t '__int128'
|-TypedefDecl 0x204f6f0 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128'
|-TypedefDecl 0x204fab0 <<invalid sloc>> <invalid sloc> implicit __builtin_va_list '__va_list_tag [1]'
|-CXXRecordDecl 0x204fb00 <test.cpp:1:1, line:6:1> line:1:7 class A definition
| |-CXXRecordDecl 0x204fc10 <col:1, col:7> col:7 implicit class A
| |-CXXConstructorDecl 0x204fd10 <line:2:5, col:7> col:5 A 'void (void)'
| |-CXXDestructorDecl 0x2088cc0 <line:3:5, col:8> col:5 ~A 'void (void)'
| |-CXXMethodDecl 0x2088d90 <line:4:5, col:12> col:10 B 'void (void)'
| |-CXXMethodDecl 0x2088e50 <line:5:5, col:12> col:10 C 'void (void)'
| `-CXXConstructorDecl 0x2088f80 <line:1:7> col:7 implicit A 'void (const class A &)' inline noexcept-unevaluated 0x2088f80
| `-ParmVarDecl 0x20890c0 <col:7> col:7 'const class A &'
|-CXXConstructorDecl 0x2089120 parent 0x204fb00 prev 0x204fd10 <line:8:1, col:9> col:4 A 'void (void)'
| `-CompoundStmt 0x2089218 <col:8, col:9>
|-CXXDestructorDecl 0x2089280 parent 0x204fb00 prev 0x2088cc0 <line:9:1, col:10> col:4 ~A 'void (void)'
| `-CompoundStmt 0x2089368 <col:9, col:10>
|-CXXMethodDecl 0x20893c0 parent 0x204fb00 prev 0x2088d90 <line:10:1, col:14> col:9 B 'void (void)'
| `-CompoundStmt 0x2089498 <col:13, col:14>
`-CXXMethodDecl 0x20894f0 parent 0x204fb00 prev 0x2088e50 <line:11:1, col:14> col:9 C 'void (void)'
`-CompoundStmt 0x20895c8 <col:13, col:14>

Problems with last recursion in metaprogramming

I have the following (partial) code in a class where I try to evaluate a value against a list of values via metaprogramming in C++11.
bool eval(GLenum value)
{
return false;
};
template<GLenum One, GLenum... Others>
bool eval(GLenum value)
{
if( value == One )
return true;
// Try out the rest
return eval<Others...>(value);
};
gcc complains:
../emul/GLPart.h: In member function ‘bool
GLPart::eval(GLenum) [with unsigned int One = 519u,
unsigned int ...Others = {}, unsigned int ...ValidEnums = {512u, 513u,
514u, 515u, 516u, 517u, 518u, 519u}, GLenum = unsigned int]’:
../emul/GLPart.h:26:31: instantiated from ‘bool
GLPart::eval(GLenum) [with unsigned int One = 518u,
unsigned int ...Others = {519u}, unsigned int ...ValidEnums = {512u,
513u, 514u, 515u, 516u, 517u, 518u, 519u}, GLenum = unsigned int]’
../emul/GLPart.h:26:31: instantiated from ‘bool
GLPart::eval(GLenum) [with unsigned int One = 517u,
unsigned int ...Others = {518u, 519u}, unsigned int ...ValidEnums =
{512u, 513u, 514u, 515u, 516u, 517u, 518u, 519u}, GLenum = unsigned
int]’ ../emul/GLPart.h:26:31: instantiated from ‘bool
GLPart::eval(GLenum) [with unsigned int One = 516u,
unsigned int ...Others = {517u, 518u, 519u}, unsigned int
...ValidEnums = {512u, 513u, 514u, 515u, 516u, 517u, 518u, 519u},
GLenum = unsigned int]’ ../emul/GLPart.h:26:31: instantiated from
‘bool GLPart::eval(GLenum) [with unsigned int One = 515u,
unsigned int ...Others = {516u, 517u, 518u, 519u}, unsigned int
...ValidEnums = {512u, 513u, 514u, 515u, 516u, 517u, 518u, 519u},
GLenum = unsigned int]’ ../emul/GLPart.h:26:31: instantiated from
‘bool GLPart::eval(GLenum) [with unsigned int One = 514u,
unsigned int ...Others = {515u, 516u, 517u, 518u, 519u}, unsigned int
...ValidEnums = {512u, 513u, 514u, 515u, 516u, 517u, 518u, 519u},
GLenum = unsigned int]’ ../emul/GLPart.h:26:31: instantiated from
‘bool GLPart::eval(GLenum) [with unsigned int One = 513u,
unsigned int ...Others = {514u, 515u, 516u, 517u, 518u, 519u},
unsigned int ...ValidEnums = {512u, 513u, 514u, 515u, 516u, 517u,
518u, 519u}, GLenum = unsigned int]’ ../emul/GLPart.h:26:31:
instantiated from ‘bool GLPart::eval(GLenum) [with
unsigned int One = 512u, unsigned int ...Others = {513u, 514u, 515u,
516u, 517u, 518u, 519u}, unsigned int ...ValidEnums = {512u, 513u,
514u, 515u, 516u, 517u, 518u, 519u}, GLenum = unsigned int]’
../emul/GLPart.h:31:43: instantiated from ‘bool
GLPart::Evaluate(GLenum) [with unsigned int ...ValidEnums
= {512u, 513u, 514u, 515u, 516u, 517u, 518u, 519u}, GLenum = unsigned
int]’ alpha.cpp:8:7: instantiated from here ../emul/GLPart.h:26:31:
error: no matching function for call to ‘GLPart<512u, 513u, 514u,
515u, 516u, 517u, 518u, 519u>::eval(GLenum&)’
So it seems like it chokes on the last recursion when One has a value and Others don't. In this case the template parameters should then be empty. Do I need to declare the ordinary eval in another way? Haven't coded C++ in a while so it may be trivial but I just don't get it ;)
When trying to add template<> to the first eval it chokes:
../emul/GLPart.h:14:11: error: explicit specialization in
non-namespace scope ‘class GLPart’ ../emul/GLPart.h:21:7:
error: too many template-parameter-lists ../emul/GLPart.h: In member
function ‘bool GLPart::Evaluate(GLenum)’:
../emul/GLPart.h:32:23: error: parameter packs not expanded with
‘...’: ../emul/GLPart.h:32:23: note: ‘ValidEnums’
../emul/GLPart.h:32:33: error: expected ‘,’ or ‘;’ before ‘...’ token
Solution:
template<GLenum One>
bool eval(GLenum value)
{
return value == One;
};
template<GLenum One, GLenum Two, GLenum... Others>
bool eval(GLenum value)
{
if( eval<One>(value) )
return true;
// Try out the rest
return eval<Two, Others...>(value);
};
As Bo Persson said, said, the first one is not a template, so calling eval will never call the first version. You want:
template<> //this tells compiler that eval is a template function
bool eval(GLenum value)
{
return false;
};
template<GLenum One, GLenum... Others>
bool eval(GLenum value)
{
if( value == One )
return true;
// Try out the rest
return eval<Others...>(value);
};
Since this tends to produce lots of ambiguity errors, the variation that seems to work unambigously looks like this:
template<GLenum One>
bool eval(GLenum value)
{
return value == One;
};
template<GLenum One, GLenum Two, GLenum... Others>
bool eval(GLenum value)
{
if( value == One )
return true;
// Try out the rest
return eval<Two, Others...>(value);
};
The first overload takes exactly one argument, the second at least two. Taking zero arguments probably doesn't make sense anyway.