What is the meaning of Romans 2:14-15?

14 For when the Gentiles, which have not the law, do by nature the things contained in the law, these, having not the law, are a law unto themselves: 15 Which shew the work of the law written in their hearts, their conscience also bearing witness, and their thoughts the mean while accusing or else excusing one another;) (Romans 2:14-15 KJV)

William Burkitt’s Commentary

The sense is that the Gentiles, who have not the law of Moses promulged, are yet not without a law ingrafted in their consciences; and although they have not a written law; yet are they a  law, that is a rule of living to themselves; doing those things which show the work of the law written in their hearts, their consciences bearing witness to it, and their natural reason either accusing or defending of them from it.

Learn, 1. That there is a law of nature ingrafted and written by God in the hearts of men, whereby the common notions of good and evil are found with them.

Learn, 2. That this law of nature serves for the instigation and provocation of men to many good actions and duties towards God and man.

3. That to rebel against, and not walk in conformity to this ingrafted law of nature, is a God-provoking and wrath procuring sin.

4. That although many of the Gentiles gave themselves over to all manner of uncleanness, yet others showed the works of the law written in their hearts: They showed it two ways.

1. By their temperance, righteousness, and moral honesty; wherein (to our shame) they excelled many of us who are called Christians.

2. In the efficacy of their conscience; which, as it cleared and comforted them for things well done, so it witnessed against them, yea judged and condemned them for doing evil: And these evidences of a law written on the heart are everywhere to be found wherever man is found:  The Gentiles having not a written law, are a law unto themselves, and shew the work of the law written in their hearts.