Non-Fermi-liquid behavior and d-wave superconductivity near the charge-density-wave quantum critical point