Custom_Object__c co = new Custom_Object__c(Name='TEST', Date_of_Visit__c=2019-06-06); insert co;
You haven't provided much in the way of details here, but I'd suspect that your issue is with the date you're trying to set to
I know that SOQL queries can handle date literals, but I don't think that the rest of Apex at large can.
You should create an instance of the Date class using something like
Date.valueOf(), and set your Date field equal to that instead.